Open-AudIT
http://www.open-audit.org/phpBB3/

Feature Requrest - SQL SERVER Detection
http://www.open-audit.org/phpBB3/viewtopic.php?f=20&t=6321
Page 1 of 1

Author:  torstenj1969 [ Tue Apr 22, 2014 11:05 pm ]
Post subject:  Feature Requrest - SQL SERVER Detection

Hi to the Team!

I have here a Little script which will Show more detailed informations about SQL Server installations. Is it possible to add this script?
Within the XLS is a complete list about all current existing SQL Servers with detailed informations about Version Number, File System Numbers, Release Date and (very important) also the fact if it is a MSDN Edition.

It would be great if it is possible to Color the line in the Database if the SQL Server would be a MSDN Edition because that is a licence violation if you use this within an production Environment.

Code:
Dim strSKUName,strSPLEVEL,strVERSION,strFILEVERSION
Dim objWMI, objProp

On Error Resume Next
'First, seek for SQL Server 2000/2005:
    Set objWMI = GetObject("WINMGMTS:\\.\root\Microsoft\SqlServer\ComputerManagement")
    If Err.Number <> 0 Then
      ' Now try SQL Server 2008/2008 R2:
         Set objWMI = GetObject("WINMGMTS:\\.\root\Microsoft\SqlServer\ComputerManagement10")
         If Err.Number <> 0 Then
            ' Next, try SQL Server 2012:
               Set objWMI = GetObject("WINMGMTS:\\.\root\Microsoft\SqlServer\ComputerManagement11")
         End If
   End If

    For Each objProp In objWMI.ExecQuery("select * from SqlServiceAdvancedProperty where SQLServiceType = 1 AND PropertyName = 'SKUNAME'")
      strSKUName = objProp.PropertyStrValue
   next
       For Each objProp In objWMI.ExecQuery("select * from SqlServiceAdvancedProperty where SQLServiceType = 1 AND PropertyName = 'SPLEVEL'")
         strSPLEVEL = objProp.PropertyStrValue
      next
          For Each objProp In objWMI.ExecQuery("select * from SqlServiceAdvancedProperty where SQLServiceType = 1 AND PropertyName = 'VERSION'")
            strVERSION = objProp.PropertyStrValue
         next
            For Each objProp In objWMI.ExecQuery("select * from SqlServiceAdvancedProperty where SQLServiceType = 1 AND PropertyName = 'VERSION'")
               strFILEVERSION = objProp.PropertyStrValue
            next
         
WScript.Echo strSKUName
WScript.Echo strSPLEVEL
WScript.Echo strVERSION
WScript.Echo strFILEVERSION


In addition it would be great also to add the Value "CLUSTERED" and to check how many instance of the SQL Server are running but I have currently no clue how to filter addional values.

Here is a CSV list of all values within "SqlServiceAdvancedProperty"

Code:
IsReadOnly,PropertyIndex,PropertyName,PropertyNumValue,PropertyStrValue,PropertyValueType,ServiceName,SqlServiceType,SetNumericalValue,SetStringValue,SetBoolValue
True,0,CLUSTERED,0,,1,SQLAgent$ADK,2,,,
True,0,CLUSTERED,0,,1,SQLBrowser,7,,,
True,0,SQLSTATES,2099205,,2,MSSQL$ADK,1,,,
True,1,INSTANCEID,,MSSQL11.ADK,0,SQLAgent$ADK,2,,,
True,1,INSTANCEID,,MSSQL11.ADK,0,SQLBrowser,7,,,
True,1,VERSION,,11.0.2100.60,0,MSSQL$ADK,1,,,
True,2,VSNAME,,,0,SQLAgent$ADK,2,,,
True,2,SPLEVEL,0,,2,MSSQL$ADK,1,,,
False,2,ERRORREPORTING,0,,1,SQLBrowser,7,,,
True,3,CLUSTERED,0,,1,MSSQL$ADK,1,,,
False,3,ERRORREPORTING,0,,1,SQLAgent$ADK,2,,,
False,3,DUMPDIR,,C:\Program Files (x86)\Microsoft SQL Server\MSSQL11.ADK\MSSQL\LOG\,0,SQLBrowser,7,,,
False,4,DUMPDIR,,C:\Program Files (x86)\Microsoft SQL Server\MSSQL11.ADK\MSSQL\LOG\,0,SQLAgent$ADK,2,,,
False,4,SQMREPORTING,0,,1,SQLBrowser,7,,,
True,4,INSTALLPATH,,C:\Program Files (x86)\Microsoft SQL Server\MSSQL11.ADK\MSSQL,0,MSSQL$ADK,1,,,
False,5,SQMREPORTING,0,,1,SQLAgent$ADK,2,,,
False,5,BROWSER,1,,1,SQLBrowser,7,,,
True,5,DATAPATH,,C:\Program Files (x86)\Microsoft SQL Server\MSSQL11.ADK\MSSQL,0,MSSQL$ADK,1,,,
True,6,LANGUAGE,1033,,2,MSSQL$ADK,1,,,
True,6,ISWOW64,1,,1,SQLAgent$ADK,2,,,
True,6,ISWOW64,1,,1,SQLBrowser,7,,,
True,7,FILEVERSION,,2011.110.2100.60,0,MSSQL$ADK,1,,,
True,8,VSNAME,,,0,MSSQL$ADK,1,,,
True,9,SKU,-1592396055,,2,MSSQL$ADK,1,,,
True,10,SKUNAME,,Express Edition,0,MSSQL$ADK,1,,,
True,11,REGROOT,,Software\Wow6432Node\Microsoft\Microsoft SQL Server\MSSQL11.ADK,0,MSSQL$ADK,1,,,
True,12,INSTANCEID,,MSSQL11.ADK,0,MSSQL$ADK,1,,,
False,13,STARTUPPARAMETERS,,-dC:\Program Files (x86)\Microsoft SQL Server\MSSQL11.ADK\MSSQL\DATA\master.mdf;-eC:\Program Files (x86)\Microsoft SQL Server\MSSQL11.ADK\MSSQL\Log\ERRORLOG;-lC:\Program Files (x86)\Microsoft SQL Server\MSSQL11.ADK\MSSQL\DATA\mastlog.ldf,0,MSSQL$ADK,1,,,
False,14,ERRORREPORTING,0,,1,MSSQL$ADK,1,,,
False,15,DUMPDIR,,C:\Program Files (x86)\Microsoft SQL Server\MSSQL11.ADK\MSSQL\LOG\,0,MSSQL$ADK,1,,,
False,16,SQMREPORTING,0,,1,MSSQL$ADK,1,,,
True,17,ISWOW64,1,,1,MSSQL$ADK,1,,,


Thanks in advance!

Attachments:
SQL Server Edition Overview.zip [34.63 KiB]
Downloaded 348 times

Page 1 of 1 All times are UTC + 10 hours
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/