Check Installed .NET Versions Using PowerShell

Here is a quick and convenient way to check for installed versions of .NET on your system(s):

Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -Recurse | Get-ItemProperty -Name Version, Release -ErrorAction 0 | where { $_.PSChildName -match '^(?!S)\p{L}'} | select PSChildName, Version, Release

PSChildName                      Version        Release
-----------                      -------        -------
v2.0.50727                       2.0.50727.5420
v3.0                             3.0.30729.5420
Windows Communication Foundation 3.0.4506.5420
Windows Presentation Foundation  3.0.6920.5011
v3.5                             3.5.30729.5420
Client                           4.7.03062      461814
Full                             4.7.03062      461814
Client                           4.0.0.0

If you just want the versions only:

Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -Recurse | Get-ItemProperty -Name Version, Release -ErrorAction 0 | where { $_.PSChildName -match '^(?!S)\p{L}'} | select PSChildName, Version, Release | Select -ExpandProperty Version

2.0.50727.5420
3.0.30729.5420
3.0.4506.5420
3.0.6920.5011
3.5.30729.5420
4.7.03062
4.7.03062
4.0.0.0

You can also sort the output by versions:

Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -Recurse | Get-ItemProperty -Name Version, Release -ErrorAction 0 | where { $_.PSChildName -match '^(?!S)\p{L}'} | select PSChildName, Version, Release | Select -ExpandProperty Version | Sort-Object Version

4.7.03062
3.5.30729.5420
4.0.0.0
4.7.03062
3.0.30729.5420
2.0.50727.5420
3.0.6920.5011
3.0.4506.5420

If you just want the highest version installed:

(Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -Recurse | Get-ItemProperty -Name Version, Release -ErrorAction 0 | where { $_.PSChildName -match '^(?!S)\p{L}'} | select PSChildName, Version, Release | Select -ExpandProperty Version | Sort-Object Version)[0]

4.7.03062

If you need to check .NET version on multiple servers:

$Servers = 
(
	"ServerA",
	"ServerB",
	"ServerC",
	"ServerD"
)

foreach ($Server in $Servers)
{

	#Write-Host $Server
	Invoke-Command -ComputerName $Server -ScriptBlock {
	Write-Output "--$(hostname)--"
	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 | Select -ExpandProperty Version | Sort-Object Version
	Write-Output "`n";

	}

}

You can call the script like this and output the content to a .txt file:

.\checkDotNet.ps1 > Output.txt

Content of Output.txt will look like this:

--ServerA--
4.5.50938
3.5.30729.5420
4.0.0.0
4.5.50938
3.0.30729.5420
2.0.50727.5420
3.0.6920.5011
3.0.4506.5420


--ServerB--
4.5.50938
3.5.30729.5420
4.0.0.0
4.5.50938
3.0.30729.5420
2.0.50727.5420
3.0.6920.5011
3.0.4506.5420


--ServerC--
4.5.51209
3.5.30729.5420
4.0.0.0
4.5.51209
3.0.30729.5420
2.0.50727.5420
3.0.6920.5011
3.0.4506.5420

--ServerD--
4.5.50709
3.5.30729.5420
4.0.0.0
4.5.50709
3.0.30729.5420
2.0.50727.5420
3.0.6920.5011
3.0.4506.5420

 

 

2
Leave a Reply

avatar
2 Comment threads
0 Thread replies
6 Followers
 
Most reacted comment
Hottest comment thread
2 Comment authors
Jay WithersMike P Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Mike P
Guest
Mike P

I installed .NET 4.7.2 and the Release Dword is 461814. Why does the registry version say 4.7.03062 ? I guess I suspected it to be 4.7.2

Jay Withers
Guest
Jay Withers

thanks v much!