Share This Post

Inventorying SQL Server Editions

Well, for many organizations, it is Microsoft Enterprise Agreement true-up time.  That means you need to have accurate counts for each edition of SQL Server (Express, Standard, Enterprise, etc.).  The Asset Intelligence built in to SCCM 2007 doesn’t seem to pull that info out – just which build number of SQL is installed.

Traditionally, the way to get the edition was to log in to each SQL Server instance and execute the SELECT @@VERSION T-SQL command.  If you want to centralize this, running that command is problematic because SQL Server no longer allows the SYSTEM account access to the query engine (by default).

To help resolve this, I’ve developed a script that can be run on SQL Servers to determine what version and edition is installed.  It turns out that when the SQL Server service starts up, it writes the edition being used to the ERRORLOG file (within the first four lines).

The script will take a look at the registry (one pass for 32-bit and another for 64-bit), looking for installed instances and where, exactly, the ERRORLOG file is stored on the file system.  It then reads the data in from the file and stores it in a new WMI class that the script dynamically creates (so it can be picked up during SCCM HW inventory).  Take a look at the attached script.  It needs to be run via the CSCRIPT engine (otherwise, please comment out the SO.Write and SO.WriteLine lines).

To gather the data, simply add an extension to your SMS_DEF.MOF (for SCCM 2007) or the WMI class WM_SQLEdition (for SCCM 2012).

DOWNLOAD: https://skydrive.live.com/redir?resid=1F4A01CD5F645C61!1137&authkey=!AIqR6QBSxaZgF1k

Share This Post

Leave a Reply