Skip to content

Instantly share code, notes, and snippets.

@wgv-zbonham
Created September 6, 2016 16:09
Show Gist options
  • Save wgv-zbonham/dec37cf081fa2934ce99ccef4d76f432 to your computer and use it in GitHub Desktop.
Save wgv-zbonham/dec37cf081fa2934ce99ccef4d76f432 to your computer and use it in GitHub Desktop.
Get-WgvDotNetVersion
# see https://blogs.msdn.microsoft.com/dotnet/2015/12/09/support-ending-for-the-net-framework-4-4-5-and-4-5-1/
#
param($computer=[environment]::MachineName)
Write-Debug "Get-WgvDotNetVersion($computer)"
$Reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $computer)
$RegKey= $Reg.OpenSubKey("SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full")
$dnversion = $RegKey.GetValue("Release")
switch($dnversion) {
"378389" { " ($dnversion) 4.5"; break }
"378675" { " ($dnversion) 4.5.1 (Win8.1 or 2012R2)"; break }
"378758" { " ($dnversion) 4.5.1 (Win8, Win7 SP1 or Vista SP2"; break }
"379893" { " ($dnversion) 4.5.2"; break }
"393295" { " ($dnversion) 4.6 Win10"; break }
"393297" { " ($dnversion) 4.6 Win8.x, Win7 SP1 or 2012R2"; break }
"394254" { " ($dnversion) 4.6.1 Win10"; break }
"394271" { " ($dnversion) 4.6.1 Win8.x, Win7 SP1+ or 2012R2"; break }
default { "($dnversion) Unknown .NET Framework"; break}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment