Skip to content

Instantly share code, notes, and snippets.

@ploegert
Last active August 29, 2015 14:24
Show Gist options
  • Select an option

  • Save ploegert/48e1657e6193e92bcfdb to your computer and use it in GitHub Desktop.

Select an option

Save ploegert/48e1657e6193e92bcfdb to your computer and use it in GitHub Desktop.
Get .NET version that is currently deployed
Function Get-dotNetVersion
{
$installedDotNet = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" | Select-Object -ExpandProperty Release -ErrorAction Stop
switch ($installedDotNet)
{
393273 { $ret = "4.6 RC" }
381029 { $ret = "4.6 RC-older" }
379893 { $ret = "4.5.2" }
378675 { $ret = "4.5.1" }
378758 { $ret = "4.5.1" }
378389 { $ret = "4.5" }
}
write-verbose -Verbose:$true "Current .NET Framework Installed: $ret"
}
Get-dotNetVersion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment