<r>If you're going to use the registry you have to recurse in order to get the full version for the 4.x Framework. The earlier answers both return the root number on my system for .NET 3.0 (where the WCF and WPF numbers, which are nested under 3.0, are higher -- I can't explain that), and fail to return anything for 4.0 ... <br/>
<br/>
EDIT: For .Net 4.5 and up, this changed slightly again, so there's now a nice MSDN article here explaining how to convert the Release value to a .Net version number, it's a total train wreck <E>:-(</E><br/>
<br/>
This looks right to me (note that it outputs separate version numbers for WCF & WPF on 3.0. I don't know what that's about). It also outputs both Client and Full on 4.0 (if you have them both installed):<br/>
<br/>
Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -recurse |<br/>
Get-ItemProperty -name Version,Release -EA 0 |<br/>
Where { $_.PSChildName -match '^(?!S)\p{L}'} |<br/>
Select PSChildName, Version, Release<br/>
<br/>
```<br/>
<br/>
Based on the MSDN article, you could build a lookup table and return the marketing product version number for releases after 4.5:<br/>
<br/>
```<br/>
$Lookup = @{<br/>
378389 = [version]'4.5'<br/>
378675 = [version]'4.5.1'<br/>
378758 = [version]'4.5.1'<br/>
379893 = [version]'4.5.2'<br/>
393295 = [version]'4.6'<br/>
393297 = [version]'4.6'<br/>
394254 = [version]'4.6.1'<br/>
394271 = [version]'4.6.1'<br/>
394802 = [version]'4.6.2'<br/>
394806 = [version]'4.6.2'<br/>
460798 = [version]'4.7'<br/>
460805 = [version]'4.7'<br/>
461308 = [version]'4.7.1'<br/>
461310 = [version]'4.7.1'<br/>
461808 = [version]'4.7.2'<br/>
461814 = [version]'4.7.2'<br/>
528040 = [version]'4.8'<br/>
528049 = [version]'4.8'<br/>
}<br/>
<br/>
# For One True framework (latest .NET 4x), change the Where-Object match <br/>
# to PSChildName -eq "Full":<br/>
Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP'<br/>
<br/>
*(Réponse tronquée)*</r>