Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -Recurse | Get-ItemProperty -Name version -EA 0 | Where { $_.PSChildName -Match '^(?!S)\p{L}'} | Select PSChildName, version
$release = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full").Release
switch ($release) {
{ $_ -ge 528040 } { "4.8"; Break }
{ $_ -ge 461808 } { "4.7.2"; Break }
{ $_ -ge 461308 } { "4.7.1"; Break }
{ $_ -ge 460798 } { "4.7"; Break }
{ $_ -ge 394802 } { "4.6.2"; Break }
{ $_ -ge 394254 } { "4.6.1"; Break }
{ $_ -ge 393295 } { "4.6" ; Break }
{ $_ -ge 379893 } { "4.5.2"; Break }
{ $_ -ge 378675 } { "4.5.1"; Break }
{ $_ -ge 378389 } { "4.5" ; Break }
Default { "No 4.5 or later version detected $_" }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment