Check .net Version Powershell

Check .net Version Powershell Average ratng: 7,4/10 1707 reviews

I am trying to find version of.NET installed on a list of servers. What would be a PowerShell script to do the same where servers are provided as a.txt file and they are enumerated to find the.NET. Determine if.NET Core is installed, and its versions. If you want to know whether.NET Core is installed and, if yes, the available versions, you can use PowerShell. On Stack Overflow, Andriy Tolstoy lists a way to list the.NET Core runtimes available, and the SDK’s.

  1. What Powershell Version Do I Have
  2. .net Release 461814
  3. .net 461814
-->

Users can install and run multiple versions of the .NET Framework on their computers. When you develop or deploy your app, you might need to know which .NET Framework versions are installed on the user’s computer.

The .NET Framework consists of two main components, which are versioned separately:

  • A set of assemblies, which are collections of types and resources that provide the functionality for your apps. The .NET Framework and assemblies share the same version number.

    How to connect projector to laptop windows 10

  • The common language runtime (CLR), which manages and executes your app's code. The CLR is identified by its own version number (see Versions and Dependencies).

Note

Each new version of the .NET Framework retains features from the previous versions and adds new features. You can load multiple versions of the .NET Framework on a single computer at the same time, which means that you can install the .NET Framework without having to uninstall previous versions. In general, you shouldn't uninstall previous versions of the .NET Framework, because an application you use may depend on a specific version and may break if that version is removed.

There is a difference between the .NET Framework version and the CLR version:

  • The .NET Framework version is based on the set of assemblies that form the .NET Framework class library. For example, .NET Framework versions include 4.5, 4.6.1, and 4.7.2.
  • The CLR version is based on the runtime on which .NET Framework applications execute. A single CLR version typically supports multiple .NET Framework versions. For example, CLR version 4.0.30319.xxxxx supports .NET Framework versions 4 through 4.5.2, where xxxxx is less than 42000, and CLR version 4.0.30319.42000 supports .NET Framework versions starting with .NET Framework 4.6.

For more information about versions, see .NET Framework versions and dependencies.

To get a list of the .NET Framework versions installed on a computer, you access the registry. You can either use the Registry Editor to view the registry or use code to query it:

  • Find newer .NET Framework versions (4.5 and later):
  • Find older .NET Framework versions (1–4):

To get a list of the CLR versions installed on a computer, use a tool or code:

For information about detecting the installed updates for each version of the .NET Framework, see How to: Determine which .NET Framework updates are installed.

Find newer .NET Framework versions (4.5 and later)

Find .NET Framework versions 4.5 and later in the registry

  1. From the Start menu, choose Run, enter regedit, and then select OK.

    You must have administrative credentials to run regedit.

  2. In the Registry Editor, open the following subkey: HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDPv4Full. If the Full subkey isn't present, then you don't have the .NET Framework 4.5 or later installed.

    Note

    The NET Framework Setup folder in the registry does not begin with a period.

  3. Check for a DWORD entry named Release. If it exists, then you have .NET Framework 4.5 or later versions installed. Its value is a release key that corresponds to a particular version of the .NET Framework. In the following figure, for example, the value of the Release entry is 378389, which is the release key for .NET Framework 4.5.

The following table lists the value of the Release DWORD on individual operating systems for .NET Framework 4.5 and later versions.

Important

The following table lists the keys of released versions of the .NET Framework only. It doesn't list the keys of preview or pre-release versions.

.NET Framework versionValue of the Release DWORD
.NET Framework 4.5All Windows operating systems: 378389
.NET Framework 4.5.1On Windows 8.1 and Windows Server 2012 R2: 378675
On all other Windows operating systems: 378758
.NET Framework 4.5.2All Windows operating systems: 379893
.NET Framework 4.6On Windows 10: 393295
On all other Windows operating systems: 393297
.NET Framework 4.6.1On Windows 10 November Update systems: 394254
On all other Windows operating systems (including Windows 10): 394271
.NET Framework 4.6.2On Windows 10 Anniversary Update and Windows Server 2016: 394802
On all other Windows operating systems (including other Windows 10 operating systems): 394806
.NET Framework 4.7On Windows 10 Creators Update: 460798
On all other Windows operating systems (including other Windows 10 operating systems): 460805
.NET Framework 4.7.1On Windows 10 Fall Creators Update and Windows Server, version 1709: 461308
On all other Windows operating systems (including other Windows 10 operating systems): 461310
.NET Framework 4.7.2On Windows 10 April 2018 Update and Windows Server, version 1803: 461808
On all Windows operating systems other than Windows 10 April 2018 Update and Windows Server, version 1803: 461814
.NET Framework 4.8On Windows 10 May 2019 Update: 528040
On all others Windows operating systems (including other Windows 10 operating systems): 528049

You can use these values as follows:

  • To determine whether a specific version of the .NET Framework is installed on a particular version of the Windows operating system, test whether the Release DWORD value is equal to the value listed in the table. For example, to determine whether .NET Framework 4.6 is present on a Windows 10 system, test for the a Release value that is equal to 393295.

  • To determine whether a minimum version of the .NET Framework is present, use the smaller RELEASE DWORD value for that version. For example, if your application runs under .NET Framework 4.6 or a later version, test for a RELEASE DWORD value that is greater than or equal to 393295. For a table that lists only the minimum RELEASE DWORD value for each .NET Framework version, see The minimum values of the Release DWORD for .NET Framework 4.5 and later versions.

  • To test for multiple versions, begin by testing for a value that is greater than or equal to the smaller DWORD value for the latest .NET Framework version, and then compare the value with the smaller DWORD value for each successive earlier version. For example, if your application requires .NET Framework 4.7 or later and you want to determine the specific version of .NET Framework present, start by testing for a RELEASE DWORD value that is great than or equal to to 461808 (the smaller DWORD value for .NET Framework 4.7.2). Then compare the RELEASE DWORD value with the smaller value for each later .NET Framework version. For a table that lists only the minimum RELEASE DWORD value for each .NET Framework version, see The minimum values of the Release DWORD for .NET Framework 4.5 and later versions.

Find .NET Framework versions 4.5 and later with code

  1. Use the RegistryKey.OpenBaseKey and RegistryKey.OpenSubKey methods to access the HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDPv4Full subkey in the Windows registry.

    The existence of the Release DWORD entry in the HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDPv4Full subkey indicates that the .NET Framework 4.5 or a later version is installed on a computer.

  2. Check the value of the Release entry to determine the installed version. To be forward-compatible, check for a value greater than or equal to the value listed in the .NET Framework version table.

The following example checks the value of the Release entry in the registry to find the .NET Framework 4.5 and later versions that are installed:

This example follows the recommended practice for version checking:

  • It checks whether the value of the Release entry is greater than or equal to the value of the known release keys.

  • It checks in order from most recent version to earliest version.

Check for a minimum-required .NET Framework version (4.5 and later) with PowerShell

  • Use PowerShell commands to check the value of the Release entry of the HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDPv4Full subkey.

The following examples check the value of the Release entry to determine whether the .NET Framework 4.6.2 or later is installed. This code returns True if it's installed and False otherwise.

To check for a different minimum-required .NET Framework version, replace 394802 in these examples with a Release value from the .NET Framework version table.

Find older .NET Framework versions (1–4)

Find .NET Framework versions 1–4 in the registry

  1. From the Start menu, choose Run, enter regedit, and then select OK.

    You must have administrative credentials to run regedit.

  2. In the Registry Editor, open the following subkey: HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDP:

    • For .NET Framework versions 1.1 through 3.5, each installed version is listed as a subkey under the HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDP subkey. For example, HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDPv3.5. The version number is stored as a value in the version subkey's Version entry.

    • For .NET Framework 4, the Version entry is under the HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDPv4.0Client subkey, the HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDPv4.0Full subkey, or under both subkeys.

    Note

    The NET Framework Setup folder in the registry does not begin with a period.

    The following figure shows the subkey and its Version entry for the .NET Framework 3.5.

Find .NET Framework versions 1–4 with code

  • Use the Microsoft.Win32.RegistryKey class to access the HKEY_LOCAL_MACHINESoftwareMicrosoftNET Framework SetupNDP subkey in the Windows registry.

The following example finds the .NET Framework 1–4 versions that are installed:

.net

Find CLR versions

Find the current CLR version with Clrver.exe

Use the CLR Version tool (Clrver.exe) to determine which versions of the CLR are installed on a computer:

  • From a Developer Command Prompt for Visual Studio, enter clrver.

    Sample output:

Find the current CLR version with the Environment class

Important

For the .NET Framework 4.5 and later versions, don't use the Environment.Version property to detect the version of the CLR. Instead, query the registry as described in Find .NET Framework versions 4.5 and later with code.

  1. Query the Environment.Version property to retrieve a Version object.

    The returned System.Version object identifies the version of the runtime that's currently executing the code. It doesn't return assembly versions or other versions of the runtime that may have been installed on the computer.

    For the .NET Framework versions 4, 4.5, 4.5.1, and 4.5.2, the string representation of the returned Version object has the form 4.0.30319.xxxxx, where xxxxx is less than 42000. For the .NET Framework 4.6 and later versions, it has the form 4.0.30319.42000.

  2. After you have the Version object, query it as follows:

    • For the major release identifier (for example, 4 for version 4.0), use the Version.Major property.

    • For the minor release identifier (for example, 0 for version 4.0), use the Version.Minor property.

    • For the entire version string (for example, 4.0.30319.18010), use the Version.ToString method. This method returns a single value that reflects the version of the runtime that's executing the code. It doesn't return assembly versions or other runtime versions that may be installed on the computer.

The following example uses the Environment.Version property to retrieve CLR version information:

See also

titlems.datedev_langsms.customhelpviewer_keywordsms.assetidauthorms.author
How to: Determine which .NET Framework versions are installed
vb
.NET Framework, determining version
rpetrusha

Users can install and run multiple versions of the .NET Framework on their computers. When you develop or deploy your app, you might need to know which .NET Framework versions are installed on the user’s computer.

The .NET Framework consists of two main components, which are versioned separately:

  • A set of assemblies, which are collections of types and resources that provide the functionality for your apps. The .NET Framework and assemblies share the same version number.

  • The common language runtime (CLR), which manages and executes your app's code. The CLR is identified by its own version number (see Versions and Dependencies).

[!NOTE]Each new version of the .NET Framework retains features from the previous versions and adds new features. You can load multiple versions of the .NET Framework on a single computer at the same time, which means that you can install the .NET Framework without having to uninstall previous versions. In general, you shouldn't uninstall previous versions of the .NET Framework, because an application you use may depend on a specific version and may break if that version is removed.

There is a difference between the .NET Framework version and the CLR version:

  • The .NET Framework version is based on the set of assemblies that form the .NET Framework class library. For example, .NET Framework versions include 4.5, 4.6.1, and 4.7.2.
  • The CLR version is based on the runtime on which .NET Framework applications execute. A single CLR version typically supports multiple .NET Framework versions. For example, CLR version 4.0.30319.xxxxx supports .NET Framework versions 4 through 4.5.2, where xxxxx is less than 42000, and CLR version 4.0.30319.42000 supports .NET Framework versions starting with .NET Framework 4.6.

For more information about versions, see .NET Framework versions and dependencies.

To get a list of the .NET Framework versions installed on a computer, you access the registry. You can either use the Registry Editor to view the registry or use code to query it:

  • Find newer .NET Framework versions (4.5 and later):
  • Find older .NET Framework versions (1–4):

To get a list of the CLR versions installed on a computer, use a tool or code:

For information about detecting the installed updates for each version of the .NET Framework, see How to: Determine which .NET Framework updates are installed.

Find newer .NET Framework versions (4.5 and later)

Find .NET Framework versions 4.5 and later in the registry

  1. From the Start menu, choose Run, enter regedit, and then select OK.

    You must have administrative credentials to run regedit.

  2. In the Registry Editor, open the following subkey: HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDPv4Full. If the Full subkey isn't present, then you don't have the .NET Framework 4.5 or later installed.

    [!NOTE]The NET Framework Setup folder in the registry does not begin with a period.

  3. Check for a DWORD entry named Release. If it exists, then you have .NET Framework 4.5 or later versions installed. Its value is a release key that corresponds to a particular version of the .NET Framework. In the following figure, for example, the value of the Release entry is 378389, which is the release key for .NET Framework 4.5.

The following table lists the value of the Release DWORD on individual operating systems for .NET Framework 4.5 and later versions.

[!INCLUDERelease key values note]

.NET Framework versionValue of the Release DWORD
.NET Framework 4.5All Windows operating systems: 378389
.NET Framework 4.5.1On Windows 8.1 and Windows Server 2012 R2: 378675
On all other Windows operating systems: 378758
.NET Framework 4.5.2All Windows operating systems: 379893
.NET Framework 4.6On Windows 10: 393295
On all other Windows operating systems: 393297
.NET Framework 4.6.1On Windows 10 November Update systems: 394254
On all other Windows operating systems (including Windows 10): 394271
.NET Framework 4.6.2On Windows 10 Anniversary Update and Windows Server 2016: 394802
On all other Windows operating systems (including other Windows 10 operating systems): 394806
.NET Framework 4.7On Windows 10 Creators Update: 460798
On all other Windows operating systems (including other Windows 10 operating systems): 460805
.NET Framework 4.7.1On Windows 10 Fall Creators Update and Windows Server, version 1709: 461308
On all other Windows operating systems (including other Windows 10 operating systems): 461310
.NET Framework 4.7.2On Windows 10 April 2018 Update and Windows Server, version 1803: 461808
On all Windows operating systems other than Windows 10 April 2018 Update and Windows Server, version 1803: 461814
.NET Framework 4.8On Windows 10 May 2019 Update: 528040
On all others Windows operating systems (including other Windows 10 operating systems): 528049

You can use these values as follows:

  • To determine whether a specific version of the .NET Framework is installed on a particular version of the Windows operating system, test whether the Release DWORD value is equal to the value listed in the table. For example, to determine whether .NET Framework 4.6 is present on a Windows 10 system, test for the a Release value that is equal to 393295.

  • To determine whether a minimum version of the .NET Framework is present, use the smaller RELEASE DWORD value for that version. For example, if your application runs under .NET Framework 4.6 or a later version, test for a RELEASE DWORD value that is greater than or equal to 393295. For a table that lists only the minimum RELEASE DWORD value for each .NET Framework version, see The minimum values of the Release DWORD for .NET Framework 4.5 and later versions.

  • To test for multiple versions, begin by testing for a value that is greater than or equal to the smaller DWORD value for the latest .NET Framework version, and then compare the value with the smaller DWORD value for each successive earlier version. For example, if your application requires .NET Framework 4.7 or later and you want to determine the specific version of .NET Framework present, start by testing for a RELEASE DWORD value that is great than or equal to to 461808 (the smaller DWORD value for .NET Framework 4.7.2). Then compare the RELEASE DWORD value with the smaller value for each later .NET Framework version. For a table that lists only the minimum RELEASE DWORD value for each .NET Framework version, see The minimum values of the Release DWORD for .NET Framework 4.5 and later versions.

Find .NET Framework versions 4.5 and later with code

  1. Use the xref:Microsoft.Win32.RegistryKey.OpenBaseKey%2A?displayProperty=nameWithType and xref:Microsoft.Win32.RegistryKey.OpenSubKey%2A?displayProperty=nameWithType methods to access the HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDPv4Full subkey in the Windows registry.

    The existence of the Release DWORD entry in the HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDPv4Full subkey indicates that the .NET Framework 4.5 or a later version is installed on a computer.

  2. Check the value of the Release entry to determine the installed version. To be forward-compatible, check for a value greater than or equal to the value listed in the .NET Framework version table.

The following example checks the value of the Release entry in the registry to find the .NET Framework 4.5 and later versions that are installed:

[!code-csharpListVersions#5][!code-vbListVersions#5]

This example follows the recommended practice for version checking:

Version
  • It checks whether the value of the Release entry is greater than or equal to the value of the known release keys.

  • It checks in order from most recent version to earliest version.

Check for a minimum-required .NET Framework version (4.5 and later) with PowerShell

  • Use PowerShell commands to check the value of the Release entry of the HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDPv4Full subkey.

The following examples check the value of the Release entry to determine whether the .NET Framework 4.6.2 or later is installed. This code returns True if it's installed and False otherwise.

To check for a different minimum-required .NET Framework version, replace 394802 in these examples with a Release value from the .NET Framework version table.

Find older .NET Framework versions (1–4)

Find .NET Framework versions 1–4 in the registry

  1. From the Start menu, choose Run, enter regedit, and then select OK.

    You must have administrative credentials to run regedit.

  2. In the Registry Editor, open the following subkey: HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDP:

    • For .NET Framework versions 1.1 through 3.5, each installed version is listed as a subkey under the HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDP subkey. For example, HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDPv3.5. The version number is stored as a value in the version subkey's Version entry.

    • For .NET Framework 4, the Version entry is under the HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDPv4.0Client subkey, the HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDPv4.0Full subkey, or under both subkeys.

    [!NOTE]The NET Framework Setup folder in the registry does not begin with a period.

    The following figure shows the subkey and its Version entry for the .NET Framework 3.5.

Find .NET Framework versions 1–4 with code

  • Use the xref:Microsoft.Win32.RegistryKey?displayProperty=nameWithType class to access the HKEY_LOCAL_MACHINESoftwareMicrosoftNET Framework SetupNDP subkey in the Windows registry.

The following example finds the .NET Framework 1–4 versions that are installed:

Check .net Version Powershell

[!code-csharpListVersions][!code-vbListVersions]

Find CLR versions

Find the current CLR version with Clrver.exe

What Powershell Version Do I Have

Use the CLR Version tool (Clrver.exe) to determine which versions of the CLR are installed on a computer:

  • From a Developer Command Prompt for Visual Studio, enter clrver.

    Sample output:

Find the current CLR version with the Environment class

[!IMPORTANT]For the .NET Framework 4.5 and later versions, don't use the xref:System.Environment.Version%2A?displayProperty=nameWithType property to detect the version of the CLR. Instead, query the registry as described in Find .NET Framework versions 4.5 and later with code.

  1. Query the xref:System.Environment.Version?displayProperty=nameWithType property to retrieve a xref:System.Version object.

    The returned System.Version object identifies the version of the runtime that's currently executing the code. It doesn't return assembly versions or other versions of the runtime that may have been installed on the computer.

    For the .NET Framework versions 4, 4.5, 4.5.1, and 4.5.2, the string representation of the returned xref:System.Version object has the form 4.0.30319.xxxxx, where xxxxx is less than 42000. For the .NET Framework 4.6 and later versions, it has the form 4.0.30319.42000.

  2. After you have the Version object, query it as follows:

    • For the major release identifier (for example, 4 for version 4.0), use the xref:System.Version.Major%2A?displayProperty=nameWithType property.

    • For the minor release identifier (for example, 0 for version 4.0), use the xref:System.Version.Minor%2A?displayProperty=nameWithType property.

    • For the entire version string (for example, 4.0.30319.18010), use the xref:System.Version.ToString%2A?displayProperty=nameWithType method. This method returns a single value that reflects the version of the runtime that's executing the code. It doesn't return assembly versions or other runtime versions that may be installed on the computer.

.net Release 461814

The following example uses the xref:System.Environment.Version%2A?displayProperty=nameWithType property to retrieve CLR version information:

[!code-csharpListVersions][!code-vbListVersions]

.net 461814

See also