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

_________________________
Today is the tomorrow you worried about yesterday.