Created
May 15, 2017 17:03
-
-
Save Iristyle/2d999d71ed47a939d1bbec8213eafdcc to your computer and use it in GitHub Desktop.
Enumerate .NET Versions using PowerShell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -recurse | | |
Get-ItemProperty -name Version,Release -EA 0 | | |
Where { $_.PSChildName -match '^(?!S)\p{L}'} | | |
Select PSChildName, Version, Release, @{ | |
name="Product" | |
expression={ | |
switch -regex ($_.Release) { | |
"378389" { [Version]"4.5" } | |
"378675|378758" { [Version]"4.5.1" } | |
"379893" { [Version]"4.5.2" } | |
"393295|393297" { [Version]"4.6" } | |
"394254|394271" { [Version]"4.6.1" } | |
"394802|394806" { [Version]"4.6.2" } | |
"460798" { [Version]"4.7" } | |
{$_ -gt 460798} { [Version]"Undocumented 4.7 or higher, please update script" } | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Info on .NET binding redirects - https://msdn.microsoft.com/en-us/library/w4atty68%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396
Inside Puppet at https://github.com/puppetlabs/puppet-agent/blob/master/resources/files/windows/elevate.exe.config