-
-
Save janv8000/b29d94b7c00dc0116c8f97eeec6323e2 to your computer and use it in GitHub Desktop.
PowerShell script to return all installed .NET Framework versions.
This file contains 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
<# | |
.Synopsis | |
Returns the install .NET Framework versions. | |
.Description | |
The script looks through the registry using the notes from the below | |
MSDN links to determine which versions of .NET are installed. | |
- https://msdn.microsoft.com/en-us/library/bb822049(v=vs.110).aspx | |
- https://msdn.microsoft.com/en-us/library/hh925568(v=vs.110).aspx | |
.Notes | |
AUTHOR: David Mohundro | |
#> | |
$ndpDirectory = 'hklm:\SOFTWARE\Microsoft\NET Framework Setup\NDP\' | |
if (Test-Path "$ndpDirectory\v2.0.50727") { | |
$version = Get-ItemProperty "$ndpDirectory\v2.0.50727" -name Version | select Version | |
$version | |
} | |
if (Test-Path "$ndpDirectory\v3.0") { | |
$version = Get-ItemProperty "$ndpDirectory\v3.0" -name Version | select Version | |
$version | |
} | |
if (Test-Path "$ndpDirectory\v3.5") { | |
$version = Get-ItemProperty "$ndpDirectory\v3.5" -name Version | select Version | |
$version | |
} | |
if (Test-Path "$ndpDirectory\v4\Full") { | |
$release = Get-ItemProperty "$ndpDirectory\v4\Full" -name Release | select -expand Release | |
$version = Get-ItemProperty "$ndpDirectory\v4\Full" -name Version | select -expand Version | |
Write-Host $version '(Release:' $release')' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Include release for v4+ versions cfr. https://msdn.microsoft.com/en-us/library/hh925568(v=vs.110).aspx#net_b