Gargoyle
(MM club member)
2009-01-15 07:30 PM
Problems with WMIService()

Not that I think the UDF is broken, but it is returning an error code of 2 (WMI not available), yet I know that it is running on the server that I am attempting to connect to.

Here is the code that I am using, any troubleshooting tips you can provide I would appreciate.

 Code:
$nul = WMIService("My Service Name","Stop",,"\\server")

;  Wait for the service to stop

While WMIService("My Service Name","Query",,"\\server") <> "Stopped"

Loop



NTDOCAdministrator
(KiX Master)
2009-01-15 07:58 PM
Re: Problems with WMIService()

Did you try this UDF?
WMIConfirm() - Confirm access and version of WMI


Gargoyle
(MM club member)
2009-01-15 09:34 PM
Re: Problems with WMIService()

Hey Thanks Doc. Found the problem. Do not put the "\\" in the server name.