Manage Windows Services using Command Prompt

I think the reason people would need this is because:

  1. They want to write a script that monitors or manages certain services;
  2. They need to login through Remote PowerShell or an SSH Server to manage the service.

Here are some quick tips for managing windows service using the command prompt:

  1. List the status of all services.
    sc query type= service | more
  2. Filter the list of services using service name and wildcards. In the example below 'intel%' is the service name that we are searching for and '%' is the wildcard character.
    wmic service where "name like 'intel%'" list status
  3. Query the configuration of a service.
    sc qc [servicename]
  4. Configure the service to start automatically.
    sc config [servicename] start= auto
  5. Disable the service.
    sc config [servicename] start= disabled
  6. Manually start the service.
    net start [servicename]
  7. Manually stop the service.
    net stop [servicename]

 

References:
http://www.jasonn.com/enable_windows_services_command_line
http://technet.microsoft.com/en-us/library/cc736564%28v=ws.10%29.aspx