ericyoung
ericyoung

Reputation: 641

WMI GetObject Error

On Windows XP, in my vbscript, I am using

GetObject("winmgmts:\.\root\cimv2")

to get WMI service object, but always get error: (null): Invalid syntax. I checked the syntax, it should be ok. I even tried to rebuild the Repo as suggested here , but still got the same error. I guess it might be permission/security policy issue. Any suggestions?

Upvotes: 0

Views: 2909

Answers (1)

RRUZ
RRUZ

Reputation: 136451

Your syntax is wrong you are missing a \

instead use

GetObject("winmgmts:\\.\root\cimv2");

or even better you can get the instance of the WMI class directly including the WMI path

GetObject("winmgmts:\\.\root\cimv2:Win32_LogicalDisk='C:'")

Upvotes: 2

Related Questions