How make WMI works with xp+sp3 and Vista?
With Win XP+Sp2 VB6+sp6 WMI worked perfectly to retrieve Motherboard and CPU serial numbers. But on my friends machines with 1) Win XP+Sp3 and 2) Vista it became completely deaf. I am not authorized to alter the other machines configurations manually (installing or uninstalling).
How can I solve the problem plz? :)
Re: How make WMI works with xp+sp3 and Vista?
as you don't show the code you are using hard to say, my wmi program works ok in vista, you probably need to use impersonate, to elevate permissions
Re: How make WMI works with xp+sp3 and Vista?
Thank you very much for your response: here is a piece of code which did not work
Public Function MBSerialNumber() As String
Dim objs As Object: Dim obj As Object:
Dim WMI As Object: Dim sAns As String
Set WMI = GetObject("WinMgmts:")
Set objs = WMI.InstancesOf("Win32_BaseBoard")
For Each obj In objs
sAns = sAns & obj.SerialNumber
If sAns < objs.Count Then sAns = sAns & ","
Next
MBSerialNumber = sAns
End Function
I get such error message:
automation error
The system cannot find the file specified
Referring to
For Each obj In objs in the cod
Hopping that helps for better understanding the problem :confused:
Re: How make WMI works with xp+sp3 and Vista?
try this one
vb Code:
Set WMIObjectSet = GetObject("winmgmts:\\.\root\CIMV2").ExecQuery("SELECT * FROM Win32_BaseBoard")
For Each WMIObject In WMIObjectSet
outstr = outstr & WMIObject.SystemProperties_("__CLASS")
For Each WMIProperty In WMIObject.Properties_
outstr = outstr & vbNewLine & WMIProperty.Name & " = "
outstr = outstr & WMIProperty.Value & vbNullString
Next
outstr = outstr & vbNewLine
Next
Debug.Print outstr
Set WMIObjectSet = Nothing
or see http://www.winscripter.com/WSH/WMI/114.aspx for impersonation levels
Re: How make WMI works with xp+sp3 and Vista?
westconn1: Thank you for the code you send but unfortunatly it didn't help as the same arror nesaage appeared at second item of the code, namely:
westconn1: Thank you for the code you send but unfortunately it didn't help as the same error message appeared referring to the second item of the code, namely:
For Each WmiObject In WMIObjectSet
Hopping someone can find a solution to this strange problem:)
Re: How make WMI works with xp+sp3 and Vista?
i tested the same code in vista without problem
vista home premium
try using impersonate
Re: How make WMI works with xp+sp3 and Vista?
Westconn1: Thank you a lot for the clarification, probably the code you mentioned will work perfectly on Vista. The problem is that all cods calling for WMI are not working on my friend’s computer with XP-Sp3 system installed. I wish if I know how to use impersonate. Honestly, I have never heard of it yet. Very much obliged for your suggestion and any suggestion from anyone. :wave:
Re: How make WMI works with xp+sp3 and Vista?
Here is an article confirms that the problems are not with the codes sent but with XpSp-3 itself probably WMI operations are among the ones effected. The question is how to overcome such problems n order to make VB6 works smoothly with this monster? :p
http://community.contractwebdevelopm...p-sp3-problems
Re: How make WMI works with xp+sp3 and Vista?
to use impersonate
try like
vb Code:
Set WMIObjectSet = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\CIMV2").ExecQuery("SELECT * FROM Win32_BaseBoard")
i will see if i can test on sp3 later
Re: How make WMI works with xp+sp3 and Vista?
Great thank for your care, unfortunately it did not work. :cry: