Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Domain,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.IPAddress,
tblAssets.Lastseen,
tblAssets.Lasttried,
tblRegistry.Regkey,
tblRegistry.Valuename,
tblRegistry.Value As Build,
Version = Case tblRegistry.Value
When '378389' Then '4.5'
When '378675' Then '4.5.1'
When '378758' Then '4.5.1'
When '379893' Then '4.5.2'
When '393295' Then '4.6'
When '393297' Then '4.6'
When '394254' Then '4.6.1'
When '394271' Then '4.6.1'
When '394802' Then '4.6.2'
When '394806' Then '4.6.2'
When '460798' Then '4.7'
When '460805' Then '4.7'
When '461308' Then '4.7.1'
When '461310' Then '4.7.1'
When '461808' Then '4.7.2'
When '461814' Then '4.7.2'
When '528040' Then '4.8'
When '528049' Then '4.8'
Else '?'
End
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Inner Join tblRegistry On tblAssets.AssetID = tblRegistry.AssetID
Where
tblRegistry.Regkey =
'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' And
tblRegistry.Valuename = 'release' And tblAssetCustom.State = 1
Order By Build,
tblAssets.AssetName
--Used to reference reg keys to Version numbers, for future updates to the query
--https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/versions-and-dependencies
--https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed