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 khổng lồ 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 menu of the .NET Framework versions installed on your computer in several ways.

Bạn đang xem: Security check


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 HKLMSOFTWAREMicrosoftNET Framework SetupNDP. This reg key contains information about all versions of .NET on the computer. Expand any subkey & pay attention to lớn the following parameters (for .Net 4.x you need lớn expand the Full subkey):

Install — installation flag (if equal khổng lồ 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.

*


Tip. For .NET 4.0 and newer, if the Full subkey is missing, it means that this version of the Framework is not installed on the computer.

In this example, you can see that the .NET Framework v2.0.50727, 3.0, 3.5, và 7.0 (release 460805) are installed.
Please cảnh báo that in hệ thống operating systems starting from Windows hệ thống 2012, all basic .Net versions (3.5 & 4.5) are installed as Windows features (Installing .NET Framework 3.5 on Windows Server and Windows 10), & minor ones (4.5.1, 4.5.2, etc.) are installed as separate updates via Windows Update or WSUS.

Using the following table, you can maps the release number to the version of the .NET Framework (for .NET 4.5 và newer).

Release Number.NET Framework version
378389.NET Framework 4.5
378675NET 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, & 21H1
528040.NET Framework 4.8 on Windows 10 1903 và 1909
528449.NET Framework 4.8 on Windows server 2022 và Windows 11
528049.NET Framework 4.8 (other Window versions)

How to kiểm tra 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 khổng lồ get this information directly from the registry is by using the Get-ChildItem và Get-ItemProperty cmdlets (more about managing registry entries with PowerShell).

Xem thêm: Lạc Việt Mtd9 Eva Tra Từ Điển Online Lạc Việt Trên App Store

To display a danh sách of all versions of the .Net Framework on a computer, run the command:

Get-ChildItem ‘HKLM:SOFTWAREMicrosoftNET Framework SetupNDP’ -Recurse | Get-ItemProperty -Name version -EA 0 | Where $_.PSChildName -Match ‘^(?!S)pL’ | Select PSChildName, version

*

.Net versions 2.0, 3.0, 3.5, & 4.7 are installed on this computer.


Starting with .Net v4.0, the newer Framework version overwrites (replaces) the older version. Those, if .NET Framework 4.7 was installed on the computer, then when installing .NET Framework 4.8, the old version will be replaced.

(Get-ItemProperty ‘HKLM:SOFTWAREMicrosoftNET Framework SetupNDPv4Full’ -Name Release).Release

*

According to lớn the table, the number 528449 corresponds lớn the .Net Framework 4.8 on Windows 11.

List Installed .NET Versions on Remote Computers

You can remotely get a danh mục of the .Net Framework versions installed on computers on your network using PowerShell.

Here is a small PowerShell script that queries a menu 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:SOFTWAREMicrosoftNET Framework SetupNDP" -recurse $result=
()$servers= Get-Content C:Scriptsmy_servers.txtforeach ($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 danh sách of .Net Framework versions installed on remote computers.

*

You can also phối a danh mục of computers on which to kiểm tra the .NET version as follows:

$servers=
("comp1","comp2","comp3","comp4")

Or you can get a danh sách of tên miền 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 khổng lồ Find Out .NET Framework Version with CMD?

All versions of the .NET Framework are installed into the following Windows folders:

%SystemRoot%Microsoft.NETFramework%SystemRoot%Microsoft.NETFramework64

You can simply open that folder and see a list of installed .NET versions. Each version has a separate directory with a v và a version number as the folder name. You can list the installed versions of the .NET Framework from the command prompt:

dir %WINDIR%Microsoft.NetFrameworkv* /O:-N /B

*

This command will các mục all installed versions except .NET 4.5, since Framework 4.5+ is installed to lớn the v4.0.xxxxx subdirectory.