Sql-server – Reconciling dm_os_windows_info windows_sku values, gathering same info from pre SQL Server 2008 R2 instances

auditreportingsql serversql-server-2008windows

I'm developing an inventory system for RDBMS deployments. I'm starting with SQL Server, and later will be pulling in info for Oracle & other RDBMS deployments. When you query [dm_os_windows_info] there is a numeric value in the windows_sku column that is of use to me…. if I can reconcile it.

 SELECT [windows_sku] FROM [master].[sys].[dm_os_windows_info]

I can't seem to find a simple reference on reconciling this SKU value to the product. If you look at the dm_os_windows_info reference, it says to see the GetProductInfo function. On that page you find a hex value. Looks like if you convert windows_sku to hex and take the right two values it works. If anyone knows of a simpler convert table that would be great. If not I'll probably have to make one. If I have to manually put the data in a table to reference it, I may as well convert it from hex while I do it instead of doing it on the fly.

Also it looks like this view was added in SQL Server 2008 R2, yet you can see version info in server properties for earlier version instances. Where is this stored?

Properties on a 2005 instance

Note I'm trying not to have to jump out to Powershell if possible. Also trying to avoid a dependency on OLE automation being enabled.

Thanks for any help! 🙂

Best Answer

You can obtain most of the info from your screen shot from xp_msver. It goes back as far as SQL 2005. The other information might be in sys.configurations: http://msdn.microsoft.com/en-us/library/ms188345.aspx