This is a quick way to check an installed version of .NET Framework (as opposed to .NET Core). This works for any .NET Framework 4.5 or later.
We’re doing this by using a PowerShell script to get the value from the registry and a Python script to quickly match the release number to the associated .NET Framework version. This has been used so many times to get the value quickly on production servers, but use it at your own risk.
On the server where you want to check the .NET Framework version, open a PowerShell window and run the following script:
(Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full").Release
Once you see the value, you can check it using the following Python script to see what version of .NET Framework that number corresponds to.
#! python3 # Check .NET version based on the release number # Reference https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed releaseVersion = input("\nEnter .NET release number: ") def checkVersion(release): relNo = int(release) if relNo >= 528040: print('.NET Framework 4.8') elif relNo >= 461808: print('.NET Framework 4.7.2') elif relNo >= 461308: print('.NET Framework 4.7.1') elif relNo >= 460798: print('.NET Framework 4.7') elif relNo >= 394802: print('.NET Framework 4.6.2') elif relNo >= 394254: print('.NET Framework 4.6.1') elif relNo >= 393295: print('.NET Framework 4.6') elif relNo >= 379893: print('.NET Framework 4.5.2') elif relNo >= 378675: print('.NET Framework 4.5.1') elif relNo >= 378389: print('.NET Framework 4.5') else: print('No match') checkVersion(releaseVersion)
I’m sure there’s a more elegant way to do this by just running one script to do all these things but this is provided as it is.
How to Check Installed .NET Core Version
How to: Determine which .NET Framework versions are installed
How to Install Python on Windows Server
Leave a Reply