I am using the following code to stop and restart a servcie.
code:
$Service = Getobject("WinNT://@WKSTA/Norton Antivirus Server,Service")
? "@error @Serror"
$status = $service.status
?"status is "$status
If $status = 4
$Service.stop
If @ERROR = 0
Sleep 10
$service.start
? "@error @Serror - restarting service"
EndIf
EndIf

This works fine but I would rather use a more surefire way of restarting the service without the sleep command. I would like to come up with another method to ensure that the service has indeed stopped before restarting it. Sleeping for 10 works, but I'm sure on some machines that might not be long enough for the service to shut down and then I'll get an error when it attempts to start back up - not to mention that it won't restart until the next reboot.

Any suggestions?