Managing Windows Services from the Command Line

by Leon Gualee.

Share
|
Homepage | Submit your article | Contact | TOS
More articles on hardware  

You are here: Categories » Computers and technology » Hardware

You can manage services through the command-line interface as well as the GUI; in some cases, the command line can be faster and easier.

There are two ways to do this. The first is with the net command. The commands net start servicename and net stop servicename start and stop a service on the local computer. If the service name has spaces in it, you must enclose the name in quotation marks ("), and you can specify either the service's Display Name (the name listed in the Services management display), or the shorter Service Key name.

These commands can be used to quickly and easily restart a service. For example, if you had recently accessed a network host by its DNS name and the host's IP address is now changed, or if the host was offline but is now online, your computer's DNS cache will still hang on to the out-of-date address or the failure result for several minutes. Restarting the DNS service will make it discard the old, incorrect information and refresh itself. You can do this with
net stop dns  net start dns 

A more powerful command-line service management utility is sc, which can manage services on other computers, change service settings, and list information about installed services.

However, to manage services with sc, you must know the service's "Service Key name", which is usually not the name displayed in the Services management window. You can use sc to get a list of all installed services and their Service Key names, or you can refer to Table 4.8 for the names of common Windows services; the key names are printed in boldface.

Here are some sample uses of the sc utility:

  • Print a list of all services installed on the local computer, including their Automatic/Manual/Disabled setting and their Service Key names (labeled SERVICE_NAME)

    sc query  
  • Print a list of services installed on another computer named otherhost:
    sc \\otherhost query  
  • Restart the IIS web server service on computer otherhost
    sc \\otherhost w3svc stop  sc \\otherhost w3svc start 

To get a listing of sc's full command syntax, type these three lines in a command prompt window:

sc ? >x.txt  y  notepad x.txt 

(You will not be prompted for the y line.) Open the Windows Help and Support Center and search for sc for details on each subcommand.

Leave a comment or ask a question
Total comments: 0

Hardware Disclaimer

  • The e-articles directory is not responsible for any and all copyright infringements by writers and authors. If you suspect the information contained by this page for any copyright infringements, please contact us to investigate the issue
The LCD Monitor: A Thin Multimedia Collaboration Client and a New Paradigm for Collaborative Visual Communications - The LCD market is extremely competitive and commoditization has driven prices down. In an effort to increase profitability, manufacturers are seeking ways to differentiate offerings and add value t (more...)
The Technology In a LCD Monitor - Liquid Crystal display or LCD monitor is a thin and flat device for display. It is made by large number of color or monochromatic pixels which are arrayed in way of a light source or a reflector. I (more...)
What is computer and types of computers - Computer is a programmable machine. This means it can execute a programmed list of instructions and respond to new instructions that it is given. Tod (more...)
Maximize Your Printer Investment with HP Maintenance Kits - HP Maintenance Kits give owners and servicers of HP LaserJets the ability to perform basic maintenance, therefore protecting your printer investment. Keeping your HP LaserJets in top working orde (more...)
The new NoteBook HP Presario - The Compaq Presario S3000 series -- which includes the S3000NX, S3100NX, S3200NX and S3300NX -- features a sleek new design that makes these PCs a stylish addition to any home, home office or den. (more...)
What you should know before buying a laptop - In this article we will try to raise some basic questions that you need to ask yourself and some understanding of the lingo, that you should be aware of before buying a laptop. Too many laptop (more...)
Troubleshooting Computer after Dusting - Dusting a computer is one of the most important task a user must do to keep the computer alive, but sometimes problems arises after dusting. Having problems after dusting is not common s (more...)
LCD Technologies - A number of different terms describe the technologies used in the LCD panels themselves, terms like supertwist, double supertwist, and triple supertwist. In ef (more...)
Line Printers - Line printer have two distinct operating modes. They can accept text as ASCII characters, select their bit patterns from an internal character generator, and print them as a single sequence on e (more...)
Thermal Inkjets - The most common inkjet technology is called thermal because it uses heat inside its print head to boil a tiny quantity of water based ink. Boiling produces tiny bubbles of steam that can (more...)

 
free content
    Copyright © 2006 - 2012 e-articles.info.
The texts, articles and tutorials in the directory are property of their respective owners and authors.