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
An Overview of IDE Devices ~ IDE versus EIDE devices ~ The Master Slave Concept - In this article, you will learn to install and troubleshoot IDE devices. First, you’ll be given an overview of IDE devices and some of their features, and then you’ll be shown a (more...)
Why To Shutdown Your Computer Properly Each Time You Are Not Working on It - There are various reasons why you should shutdown your computer when you are not using it, especially for long periods of time. The main reasons being to save money and prevent damage to your c (more...)
Some Information about the Most Common Computer Ports - When connecting devices to your computer, you should first look at the different types of ports that can be found on it. You may already be familiar with some of the common ones, such as se (more...)
Small Computer System Interface (SCSI) ~ How to Install SCSI Host Adapter in Windows 2000 - This article discusses a type of hard disk that is more popular in high-end machines (servers) than in personal desktop computers. First, I will discuss SCSI and some of its benefits. Then (more...)
What kind of adapters do you choose to connect your iPod to your car - Whether do you ever worry about not to listen to your iPod in your car because of your stereo isn't equipped with a line input or tape deck? Now you can easy to listen your iPod with the three cate (more...)
Types of Memory - Read-only memory Read-only memory (ROM) is a type of memory that cannot be written to. Information is written to ROM chips by the manufacturer, and this information cannot be (more...)
Understanding the Computer System Resources - In this article, when you see the term system resource, I would like you to think of a setting assigned to a device that allows the device to work with the computer. A device is anyth (more...)
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...)

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