On Windows, you can install and run multiple versions of the .NET Framework at the same time. When developing or deploying a new application based on .NET libraries, sometimes you need to know in advance which versions and service packs of the .Net Framework are already installed on the user’s computer or server. You can get a list of the .NET Framework versions installed on your computer in several ways.
Checking the .NET Framework Version via the Windows Registry
When you install or update any version of the .NET Framework, the changes are written to the Windows registry.
Run the Registry Editor (regedit.exe
) and go to registry key HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP. This reg key contains information about all versions of .NET on the computer. Expand any subkey and pay attention to the following parameters (for .Net 4.x you need to expand the Full subkey):
- Install — installation flag (if equal to 1, then this version of .Net is installed on the computer);
- Install Path — the directory where this .Net version is installed;
- Release — .NET release number;
- Version — the full version number of .Net Framework.
In this example, you can see that the .NET Framework v2.0.50727, 3.0, 3.5, and 7.0 (release 460805) are installed.
Using the following table, you can map the release number to the version of the .NET Framework (for .NET 4.5 and newer).
Release Number | .NET Framework version |
378389 | .NET Framework 4.5 |
378675 | NET Framework 4.5.1 on Windows 8.1 and Windows Server 2012 R2 |
378758 | .NET Framework 4.5.1 on Windows 8, Windows 7 SP1, Windows Vista SP2 |
379893 | .NET Framework 4.5.2 |
393295 | .NET Framework 4.6 on Windows 10 |
393297 | .NET Framework 4.6 |
394254 | .NET Framework 4.6.1 on Windows 10 1511 |
394271 | .NET Framework 4.6.1 |
394802 | .NET Framework 4.6.2 on Windows 10 1607 |
394806 | .NET Framework 4.6.2 |
460798 | .NET Framework 4.7 on Windows 10 1703 |
460805 | .NET Framework 4.7 |
461308 | .NET Framework 4.7.1 on Windows 10 1709 |
461310 | .NET Framework 4.7.1 |
461808 | .NET Framework 4.7.2 on Windows 10 1803 |
461814 | .NET Framework 4.7.2 |
528372 | .NET Framework 4.8 on Windows 10 2004, 20H2, and 21H1 |
528040 | .NET Framework 4.8 on Windows 10 1903 and 1909 |
528449 | .NET Framework 4.8 on Windows Server 2022 and Windows 11 |
528049 | .NET Framework 4.8 (other Window versions) |
How to Check the .NET Framework Version with PowerShell?
You can get information about installed versions and releases of the NET Framework on your computer using PowerShell. The easiest way to get this information directly from the registry is by using the Get-ChildItem
and Get-ItemProperty
cmdlets (more about managing registry entries with PowerShell).
To display a list of all versions of the .Net Framework on a computer, run the command:
Get-ChildItem ‘HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP’ -Recurse | Get-ItemProperty -Name version -EA 0 | Where { $_.PSChildName -Match ‘^(?!S)\p{L}’} | Select PSChildName, version
.Net versions 2.0, 3.0, 3.5, and 4.7 are installed on this computer.
You can display only the release number for (.Net 4.x versions):
(Get-ItemProperty ‘HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full’ -Name Release).Release
According to the table, the number 528449 corresponds to the .Net Framework 4.8 on Windows 11.
List Installed .NET Versions on Remote Computers
You can remotely get a list of the .Net Framework versions installed on computers on your network using PowerShell.
Here is a small PowerShell script that queries a list of computers from a text file and remotely checks for installed versions of the .Net Framework. The WinRM Invoke-Command cmdlet is used to run commands on remote computers.
Function GetNetFrameworkVersion {
Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -recurse |
Get-ItemProperty -name Version,Release -EA 0 |
Where { $_.PSChildName -match '^(?![SW])\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|460805" { [Version]"4.7" }
"461308|461310" { [Version]"4.7.1" }
"461808|461814" { [Version]"4.7.2" }
"528040|528049|528449|528372" { [Version]"4.8" }
"533320|533325" { [Version]"4.8.1"}
{$_ -gt 533325} {"unidentified version (> 4.8.1)" }
}
}
}
}
$result=@()
$servers= Get-Content C:\Scripts\my_servers.txt
foreach ($server in $servers)
{
$result+=Invoke-Command -ComputerName $server -ScriptBlock $function:GetNetFrameworkVersion
}
$result| select PSComputerName,@{name = ".NET Framework"; expression = {$_.PSChildName}},Product,Version,Release| Out-GridView
The script displays a graphical table (via Out-GridView) with a list of .Net Framework versions installed on remote computers.
You can also set a list of computers on which to check the .NET version as follows:
$servers= @("comp1","comp2","comp3","comp4")
Or you can get a list of domain computers with the Get-ADComputer cmdlet (from the Active Directory for Windows PowerShell module). The following command will select all active Windows Server hosts in the domain:
$servers= Get-ADComputer -Filter 'operatingsystem -like "*Windows server*" -and enabled -eq "true"'
How to Find Out .NET Framework Version with CMD?
All versions of the .NET Framework are installed into the following Windows folders:
%SystemRoot%\Microsoft.NET\Framework
%SystemRoot%\Microsoft.NET\Framework64
You can simply open that folder and see a list of installed .NET versions. Each version has a separate directory with a v and a version number as the folder name. You can list the installed versions of the .NET Framework from the command prompt:
dir %WINDIR%\Microsoft.Net\Framework\v* /O:-N /B
This command will list all installed versions except .NET 4.5, since Framework 4.5+ is installed to the v4.0.xxxxx subdirectory.
3 comments
You are missing a colon in your posh command for the registry provider.
dir ′HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full′
Please Update the script:
“461814|461808|461814″ { [Version]”4.7.2” }
“528449|528372|528040|528049″ { [Version]”4.8” }
“533320|533325 ” { [Version]”4.8.1″ }
{$_ -gt 533325} { “Undocumented version (> 4.8), please update script” }
Note: [version] removed from last line. Otherwise you would not see that line Undocumented …
Fixed! Thanks for the info