Can I specify a namespace when using the WMI inspectors? It would appear that the only WMI queries that I can utilize are those found in the cimv2 and rsop namespaces… But I would really like to be able to check the Root\Microsoft\SqlServer namespaces too…
Microsoft has the irritating habit of incrementing the numerical value of the path with each new SQL Server release… is there a way that I can specify a wildcard in the WMI path? Something like this:
(string values of properties “PropertyStrValue” of (select objects “* from SqlServiceAdvancedProperty WHERE PropertyName = ‘Version’” of wmi “root\Microsoft\SqlServer\ComputerManagement*”))
if (exists (wmi “root\Microsoft\SqlServer\ComputerManagement”)) then (string values of properties “PropertyStrValue” of (select objects “* from SqlServiceAdvancedProperty WHERE PropertyName = ‘Version’” of wmi “root\Microsoft\SqlServer\ComputerManagement”)) else if (exists (wmi “root\Microsoft\SqlServer\ComputerManagement10”)) then (string values of properties “PropertyStrValue” of (select objects “* from SqlServiceAdvancedProperty WHERE PropertyName = ‘Version’” of wmi “root\Microsoft\SqlServer\ComputerManagement10”)) else if (exists (wmi “root\Microsoft\SqlServer\ComputerManagement11”)) then (string values of properties “PropertyStrValue” of (select objects “* from SqlServiceAdvancedProperty WHERE PropertyName = ‘Version’” of wmi “root\Microsoft\SqlServer\ComputerManagement11”)) else nothing
But now my question is this: Since I’m using this as an analysis statement, how can I modify the output to display something like ‘SQL Server 2008 Express SP1’ instead of ‘10.1.2531.0’…
EDIT
Or, is there a way that the relevance can be modified so that I can filter out all versions that start with a 9?
Realize it’s been many years since this topic, but as this is the one I kept coming across when I was searching on this, thought I’d post my solution. It was hard-won.
Which NameSpaces reside beneath root/Microsoft/SqlServer:
q: string values of properties "Name" of select objects "Name from __NAMESPACE" of wmis "root/Microsoft/SqlServer"
A: ServerEvents
A: ComputerManagement13
T: 486.220 ms
I: plural string
Which of those is a ComputerManagement namespace:
q: string values of properties "Name" of select objects "Name from __NAMESPACE WHERE Name LIKE 'ComputerManagement%25'" of wmis "root/Microsoft/SqlServer"
A: ComputerManagement13
T: 483.203 ms
I: plural string
Build a query for SQL properties, using a namespace generated by concatenating the “ComputerManagementXX” namespace to /root/Microsoft/SqlServer:
q: selects "* from SqlServiceAdvancedProperty" of wmis (("root/Microsoft/SqlServer/" & it) of string values of properties "Name" of select objects "Name from __NAMESPACE WHERE Name LIKE 'ComputerManagement%25'" of wmis "root/Microsoft/SqlServer")
A: IsReadOnly=True
A: PropertyIndex=0
A: PropertyName=SQLSTATES
A: PropertyNumValue=2053
A: PropertyStrValue
A: PropertyValueType=2
A: ServiceName=MSSQLSERVER
A: SqlServiceType=1
A: IsReadOnly=True
A: PropertyIndex=1
A: PropertyName=VERSION
A: PropertyNumValue
A: PropertyStrValue=13.2.5026.0
A: PropertyValueType=0
A: ServiceName=MSSQLSERVER
A: SqlServiceType=1
A: IsReadOnly=True
A: PropertyIndex=2
A: PropertyName=SPLEVEL
A: PropertyNumValue=2
A: PropertyStrValue
A: PropertyValueType=2
A: ServiceName=MSSQLSERVER
...and many more