Managing services using NetSVC

By Bryan Muehlberger, ITworld |  How-to

Have you ever wanted to know the real name for a service that is running
on a machine so that you can stop or start it? Usually the name that
you see in the services listing is just a display name and is not
actually the name of the service that you need to know to be able to
stop or start it from a command line.

Using a utility called NetSVC.exe from the Windows 2000 Resource Kit,
you can easily display a list of all of the services running on a local
or remote machine and even use the utility to query, stop, and start the
service.

To get the syntax for the command as well as all of the options that are
available to you, just type:

netsvc.exe /?

at the command line.

Notice that the '/list' option allows you to display a list of all
started and stopped services on a particular machine. After obtaining
this list, you can identify the name that you will need to use to stop,
start, or query the service. For example, after I ran NetSVC on a
server of mine, a portion of the output was as follows:

------------------- Begin output -------------------
, Display name is
, No separate display name
, Display name is
--------------------- End output -------------------

Notice that even though the NetMeeting service has a display name of
"NetMeeting Remote Desktop Sharing", the actual name of the service is
"mnmsrvc". Now that I know this, I can verify whether or not this
service is running by typing:

netsvc.exe mnmsrvc \\servername /query

This will query the service named mnmsrvc on the server 'servername' and
return a result similar to the following:

------------------- Begin Output -------------------
Service is stopped on \\servername
--------------------- End Output -------------------

If I wanted to start the service, I could easily type the following:

netsvc.exe mnmsrvc \\servername /start

This would start the service and I could verify that it successfully
started by performing another query against the service.

This resource kit utility would be handy to use in a script to remotely
manage services on servers, so keep it in mind the next time you have to
do some remote service management.

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Answers - Powered by ITworld

ITworld Answers helps you solve problems and share expertise. Ask a question or take a crack at answering the new questions below.

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Ask a Question