Forum Discussion

exdunepilot's avatar
exdunepilot
Contributor
8 years ago

WMI.Service is null or not an object

Calling the TC WMI.Service object or using GetObject ("WinMgmts:{impersonationLevel=impersonate}!//ComputerName/root/cimv2") yield a "null or not an object" error after calling a "WMI" method such as InstanceOf or ExecQuery etc.  I have followed TC Help "Working with WMI Objects in Scripts" and believe all settings are in place.  Also, using wbemtest.exe all classes and methods are displayed as expected and should be available for use.  Thx!

1 Reply

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Exdunepilot,

     

    You need to specify the name of your computer instead of ComputerName in the code. For example:

    GetObject ("WinMgmts:{impersonationLevel=impersonate}!//tanya/root/cimv2")
    or
    GetObject ("WinMgmts:{impersonationLevel=impersonate}!//localhost/root/cimv2")

    Does it work for you now?