General discussion


Schedule a service to stop

By dliby ·
How can I schedule a service to stop and later restart on a 2000 server?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by sgt_shultz In reply to Schedule a service to sto ...

here is sgt 2 cejts. more details on your particular situation might help us give a more complete answer. but what i would do is 2 batch files, one with net stop <servicename> and and the other with net start <servicename>
the name of the service can be tricky to find out but that is just what these guys here are good at. i am thinking you may also need to unregister and reregister a dll depending on what you are doing. for that use regsvr32

Collapse -

by Joshua1 In reply to Schedule a service to sto ...

Batch files are simple. Usage example:
File 1: Net Stop Spooler
File 2: Net Start Spooler

Schedule them 2 minutes apart and you're off.

This works for simple stuff, but gets trickier depending on the service you're tackling or how to handle errors.

I'd recommend looking into WMI/WSH. This gives you much more control (over error handling, and over the system as a whole). You can google terms like wmi, wsh, tutorial, how-to, etc. and find more info. The Microsoft Script center is a great resource:
Check out Sesame Script from the MS Script Center for an introduction to scripting.

Related Discussions

Related Forums