WMI does not return all the entries in 32 bit mode

Hello,

I have an issue related to WMI and SQL Server. I am trying to get DB instances by executing a query:

SELECT * FROM meta_class where __CLASS like 'Win32_PerfRawData_MSSQL%Database%';

For some reason when executing this query using I get 10 DB instances however I do know that the number of instances is 11 (wbemtest also shows 11). So one is missed.
I started investigating this and create a simple vb script which makes the same query:

strComputer = ""
strDomain = ""
strUsername = "Administrator"
strPassword = ""
 
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objSWbemServices = objSWbemLocator.ConnectServer(strComputer, _
    "root\cimv2", _
     strUsername, _
     strPassword, _
     "MS_409", _
     "ntlmdomain:" + strDomain)
Set colSWbemObjectSet = _
    objSWbemServices.ExecQuery("SELECT * FROM meta_class where __CLASS like 'Win32_PerfRawData_MSSQL%Database%'")
    
strResult = ""

For Each obj In colSWbemObjectSet
    strResult = strResult & "DB Name: " & obj.Path_ & vbCrLf
Next

WScript.Echo strResult

One issue that I found is when I'm running this script in a regular cmd prompt (64 bit mode) I get 11 entries (as expected). When I start cmd in 32 bit mode - '%windir%\SysWow64\cmd.exe' - the number of db instances is 10.

Could someone please help to understand what is wrong with the environment here?

Thank you in advance,
Eugene

January 14th, 2014 4:59am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics