---
title: Automate Service Management Through net stop and sc Command
description: Learn how to use the net stop, net start, sc query and other commands to manage Windows service from the command prompt.
canonical: https://adamtheautomator.com/net-stop/
---

# Automate Service Management Through net stop and sc Command

> Learn how to use the net stop, net start, sc query and other commands to manage Windows service from the command prompt.

Source: https://adamtheautomator.com/net-stop/

---

- Automate Service Management Through net stop and sc Command Tap to hide Home

- Tutorials

- Guidebooks

- Instructors

- Get Paid to Write

- Advertising

- Recommended Resources

- About Adam

                Search for:

-

-

-

-

# Automate Service Management Through net stop and sc Command

        Published:19 May 2021 - 4 min. read

- Powershell Administration
- Windows Services

          [](https://adamtheautomator.com/author/chaitanya-g/)

            [Chaitanya](https://adamtheautomator.com/author/chaitanya-g/)

            Read [more tutorials](https://adamtheautomator.com/author/chaitanya-g/) by Chaitanya!

-

        [](https://specopssoft.com/product/specops-password-auditor/?utm_source=adamtheautomator&utm_medium=referral&utm_campaign=adamtheautomator_referral_na&utm_content=display)
        Audit Active Directory for stale users, weak passwords, and other security risks with [Specops Password Auditor](https://specopssoft.com/product/specops-password-auditor/?utm_source=adamtheautomator&utm_medium=referral&utm_campaign=adamtheautomator_referral_na&utm_content=text).

Table of Contents

- Prerequisites
- Finding Service Names
- Managing Services with the SC Command
- Managing Services with the NET Stop Command
- Managing Multiple Services at Once
- Conclusion

                XFacebookLinkedIn

Every Windows admin out there has to deal with Windows services at some point. Automating service management with command-line tools like net stop and the sc command comes in handy when scripting Windows services.

In this tutorial, you will learn how to manage Windows services in just about every way from the command prompt.

Let's get started!

## Prerequisites

If you'd like to follow along with this tutorial, please make sure you have the following:

- A Windows 7+ computer. The tutorial will be using a Windows 10 Build 2004 machine.

## Finding Service Names

Since the net and sc commands are both command-line tools, it's sometimes not the easiest to find the actual service names to work with. Both commands require you to provide a service name, not the service display name. You find the service name in the services.msc console as shown below

service name in the services.msc console

## Managing Services with the SC Command

Let's kick off this service management tutorial with the sc command. The sc command is a built-in command-line tool that's been built into Windows for a long time. This command can handle everything you need to manage Windows services from the command prompt.

All commands in this section will also work on remote computers. To run sc against a remote computer, specify the computer name in the command e.g. sc \\REMOTENAME <some command>.

1. To get started, open a command prompt as administrator.

2. Run the sc query command. The sc query command queries all Windows services and returns information such as the name (SERVICE_NAME), display name (DISPLAY_NAME), state, and more. If you don't know the service name, sc query is your friend to find it.

Run the sc query command

3. Once you have the service name you'd like to work with, append the name to sc query like below to limit the output only to that particular service. You can see below that the Windows Update Agent service is STOPPED.

sc query wuauserv

Querying wuauserv service

4. Next, start the service by invoking sc start followed by the name of the service. Once you do, you'll see that Windows puts the service into a START_PENDING state while it's starting. sc start wuauserv

sc start wuauserv

Starting wuauserv service

5. Wait a few seconds and check the status of the service with sc query. You should now see that the service is running.

Querying wuauserv service status

6. Along the same line as starting a service, you can also stop a service with the sc command using the sc stop command. You'll see the service turn into a STOP_PENDING state. After a few seconds, check the status with sc query like before.

sc stop wuauserv
 sc query wuauserv

Stopping wuauserv service

7. Perhaps you'd prefer to suspend the service rather than stopping it. In that case, simply use the sc pause command. You'll see the service immediately goes into a PAUSED state. The below example is using the apphostcsv service as an example.

All the services do not support pausing. You can find all services that support pausing by running sc query and ensuring the service has a PAUSABLE state.

sc pause apphostsvc

Pausing service using SC pause

You'd then see in the Windows services applet that the service is paused.

Verifying AppHostSvc service pause

When a service is running, it maintains its internal state and cache information. When stopped, the service clears all the cache and its internal state. When paused, the service maintains the cache and internal state.

8. To resume a suspending/paused service, run the sc continuecommand. You'll then see the service immediately goes back to a RUNNING state. sc continue apphostsvc

sc continue apphostsvc

Continuing apphostsvc service

## Managing Services with the NET Stop Command

One of the oldest and most useful Windows admin commands is the net command. The net command can do a lot but one of its strengths is working with services. Using the [net](https://adamtheautomator.com/net-use/) command, you can stop, start, pause and resume services with a single command like sc.

Related:[How to Connect to Network Drives on the Command Line with Net Use](https://adamtheautomator.com/net-use/)

This section will be working with the BITS and Windows Update services as an example.

On a Windows PC:

1. Open a Command Prompt as administrator.

2. Use the net stop command to stop the BITS service providing the service name to stop. When you stop a service with net stop, you'll see the service go into a pending state and then, if all goes well, a stopped state.

net stop BITS

Unlike the sc command, net can't query the status of services.

Stopping BITS service

3. To start the service back up, replace stop with start and net will perform the opposite effect. net start BITS

net start BITS

Starting BITS service

If the service is already started, you will see a message stating "The requested service has already been started". Similarly, if the service is stopped and you attempt to stop it, you will see "The service is not started" message in output.

4. To pause a running service, similar to sc, execute the net pause command as shown below. To continue, use the continue command.

net pause AppHostSvc
net continue AppHostSvc

Pausing AppHostSvc service

Continuing AppHostSvc service

## Managing Multiple Services at Once

In the previous sections, you were working with a single service. Using the command prompt's built in [for construct](https://ss64.com/nt/for.html), you can extend that functionality to work with multiple services at once.

To manage multiple services at once:

First, create a text file like the one below with each service you'd like to start or stop separated with a new line. The for construct will read this text file. This file will be saved in C:\Temp.

bits
wuauserv

Run the below command. This command consists of six components:

- For for construct declaration
- The /F switch to tell for to read a file
- The tokens string to tell for which items in each line of the text file to process. In this case, the example uses * to tell for to read the entire line.
- The in operator and file path to specify which file to read
- The do construct to tell the for construct a command to execute
- A placeholder for each line in the text file (%A) which represents each line in the text file as the for construct processes it

In the example below, the command prompt is reading the C:\Temp\Services.txt file with line-delimited service names and running service commands against each service in the file.

for /F "tokens=*" %A in (c:\Temp\Services.txt) do sc start "%A"
for /F "tokens=*" %A in (c:\Temp\Services.txt) do net start "%A"
for /F "tokens=*" %A in (c:\Temp\Services.txt) do sc query "%A"

Starting multiple services

## Conclusion

In this tutorial, you have learned how to use the net and sc Windows commands to manage Windows services. You should now be able to stop, start, pause and resume Windows services via the command prompt.

How about taking the next step and learning how to [manage Windows services with PowerShell](https://adamtheautomator.com/powershell-start-service/)?

  Hate ads? Want to support the writer? Get many of our tutorials packaged as an ATA Guidebook.

  [Explore ATA Guidebooks](https://adamtheautomator.com/ata-guidebooks/)

## More from ATA Learning and Partners

- ### Recommended Resources! Recommended Resources for Training, Information Security, Automation, and more!

- ### Get Paid to Write! ATA Learning is always seeking instructors of all experience levels. Regardless if you’re a junior admin or system architect, you have something to share. Why not write on a platform with an existing audience and share your knowledge with the world?

- ### ATA Learning Guidebooks ATA Learning is known for its high-quality written tutorials in the form of blog posts. Support ATA Learning with ATA Guidebook PDF eBooks available offline and with no ads!

## Categories

- IT Ops

- Cloud

- DevOps

- Home Ops

- Information Security

- Software Development

## Site

- Home

- Tutorials

- Guidebooks

- Instructors

- Get Paid to Write

- Advertising

- Recommended Resources

- About Adam

        Copyright 2026&copy; ATA Learning | [Privacy Policy](https://adamtheautomator.com/privacy/)

                                                        Don't be left behind with the ATA Learning Newsletter!

Looks like you're offline!
