Discussion Locked

Stopping Services from Command Line

0 helpful
10 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

In Windows 2000 and/or NT 4.0 is there a way to stop and start services with command line stings that could be called by an AT
Command? I have a service that is interfering with a VeriTas BackupExec backup. I would like to stop the service beforethe backup is scheduled to run, and then start it after the backup has completed.

10 replies

by liquidcoolit

Yes there is.
at command prompt type in :
NET STOP

That should stop it for you

To start it type :
NET START

Cheers ....

by syscokid

The previous answer is correct. Just to expand, you would then write a bat file to stop the service, and another one to start the service, and use the AT command to run the bat files.

by mebudman

for some of the services you will need to enclose them in quotes such as
net stop "microsoft dhcp server"

just some clarification

by basicit

While technically correct the previous answers might not address your need if the server want the services stopped on is a remote server. the net stop command for services only work for local machine. for those to work you would need store the bat file on the remote server and call an AT command from your backup server. (If using Veritas BE 8.x use the Run Before box in Job Properties)
OR (the easy way)
use the NT Resource Kit command NETSVC.
write a batch file (svrstop.bat) and sore it on backup server and call it from Job Properties. To start services after the job completes write batch to start services and call it from the run after dialog box.

The command syntax is
Controls and displays the status of services.

NETSVC servicename \\computername /command

servicename Name of the service
computername Name of the computer to administer.

/start Starts the service.
/stop Stops the service.
/pause Pauses the service.
/continue Starts the paused service.Example: NETSVC server \\joes486 /query
Example: NETSVC "Clipbook Server" \\popcorn /stop
Example: NETSVC alerter \\joes486 /pause
Example: NETSVC /list \\joes486

Arguments are allowed in any order.

by nettek

While the above information is helpful, no one has told you how to find the syntax of a specific service. For example, to start the Microsoft Exchange Information Store from a command line, you would use
NET START MSEXCHANGEIS

If you would liketo know what syntax to use to start VeriTas BackupExec, there are two places you can look. Run REGEDIT and navigate to
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services

You will see a list of folders under the Services folder. The name of each of these folders is the syntax you would use to start or stop that particular service.

Service syntax can also be found by navigating to
HKEY_LOCAL_MACHINE\SOFTWARE

Highlight SOFTWARE, and do a search for "servicename". This will also lead you to the syntax used to start a service.

If the service has a space in the name, you need to put quotations around it in the NET command.

This discussion is closed to new replies.