Can't retrieve 32-bit software info on 64-bit xp using wmi

G

Guest

I am unable to retrieve software information on 64-bit XP via WMI.
For example, this code:
'---------------------------------
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set colItems = objWMIService.ExecQuery("Select * from Win32_Product",,48)

For Each objSoftware in colItems
Wscript.Echo objSoftware.Description & ", " & objSoftware.Name & ",
" & objSoftware.Vendor & ", " & objSoftware.Version
Next
'---------------------------------
works perfectly on any Windows XP 32-bit system, but not on any Windows XP
64-bit system.

Has anyone else had this experience and if so, do you know how to solve it?

Thanks in advance for any help,
Ian
 
J

Jonathan Liu [MSFT]

Exactly what error are you getting? What OS are you running on the 64 Bit
machine? If it is server then that particular provider is an optional
component.
 
G

Guest

Jonathan,

I'm running the script on a 64-bit XP workstation, not a server. I'm not
getting any error at all. The query simply returns no data.

Regards,
Ian
 
J

Jonathan Liu [MSFT]

The MSI Provider is an optional component on this system.

Go to Add\Remove programs to install. It is uder "Management and Monitoring
Tools" The name is "WMI Windows Installer Provider"

If you remove the "On Error Resume Next" you would have seen teh error,
saying that this is an invalid class.

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
 
G

Guest

Jonathan,

That worked. Thank you for showing me the error of my ways (ahem).
Lesson learned. Comment out the On Error Resume Next line when you're
debugging your script.

Ian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top