.NET Framework Detection in the Windows Registry

To determine which .NET framework is installed on the Windows computer check the values in the registry.

The HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full key contains two values you can check:

  • Release
  • Version

You can use InSpec, part of the Chef DK, to check the values:

describe registry_key('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full') do
  it { should have_property 'Release' }
  it { should have_property_value('Release', :dword, 460805) } # For dword use the decimal value, no quotes
end

describe registry_key('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full') do
  it { should have_property 'Version' }
  it { should have_property_value('Version', :string, '4.7.02053') }
end
.NET version Release key hexadecimal Release key decimal Version key Install path
4.6.1 6041F  394271
4.6.2 60636 394806 4.6.01590
4.7 70805 460805 4.7.02053 C:\Windows\Microsoft.NET\Framework64\v4.0.30319\
4.7.1 709FE 461310 4.7.02558
4.7.2 70bf6 461814 4.7.03062  C:\Windows\Microsoft.NET\Framework64\v4.0.30319\
4.8 80EB1  528049

For more information see

https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed

Leave a comment

Leave a Reply