error

  • Thread starter Thread starter Jimmy
  • Start date Start date
J

Jimmy

hi,

now i tried to use wmi, i wrote the following codes

strComputer = "abc-01"

Set wbemServices = GetObject("winmgmts:\\" & strComputer)
Set wbemObjectSet =
wbemServices.InstancesOf("Win32_LogicalMemoryConfiguration")

For Each wbemObject In wbemObjectSet
WScript.Echo "Total Physical Memory (kb): " &
wbemObject.TotalPhysicalMemory
Next
error message is the remote server machine does not exist or is unavailable:
'GetObject'code: 800A01CEsource: Microsoft VBScript runtime errorI run the
vbs file in my computer (xpp sp2) is fine but when i tried to get another
computer's information, the above error was shown.please help.thanksjimmy
 
your code like should be like this

Set wbemServices = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")


you simply forgot ("\root\cimv2"). That's all. Try that and see how it works.
 
Back
Top