---
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/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![Automate Service Management Through net stop and sc Command](https://adamtheautomator.com/wp-content/uploads/2021/05/How-to-Manage-Windows-Services-from-the-Command-Prompt-1.jpg)

# Automate Service Management Through net stop and sc Command

[![](https://secure.gravatar.com/avatar/c14b031fe4a12b0e3f4d1e112e37261df83921ddc370cdafbad2a614e36f0cf4?s=192&d=mm&r=g)Chaitanya](https://adamtheautomator.com/author/chaitanya-g/)19 May 20214 min. read

Categories: [IT Ops](/category/it-ops/)

Tags:[Powershell Administration](/tag/powershell-administration/)[Windows Services](/tag/windows-services/)

Table of Contents

*   [Prerequisites](#h-prerequisites)
*   [Finding Service Names](#h-finding-service-names)
*   [Managing Services with the SC Command](#h-managing-services-with-the-sc-command)
*   [Managing Services with the NET Stop Command](#h-managing-services-with-the-net-command)
*   [Managing Multiple Services at Once](#h-managing-multiple-services-at-once)
*   [Conclusion](#h-conclusion)

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](https://adamtheautomator.com/wp-content/uploads/2021/05/Untitled-38-2.png)

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](https://adamtheautomator.com/wp-content/uploads/2021/05/Untitled-39-2.png)

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`.

```bash
sc query wuauserv
```

![Querying wuauserv service](https://adamtheautomator.com/wp-content/uploads/2021/05/Untitled-40-2.png)

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`

```bash
sc start wuauserv
```

![Starting wuauserv service](https://adamtheautomator.com/wp-content/uploads/2021/05/Untitled-40-3.png)

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](https://adamtheautomator.com/wp-content/uploads/2021/05/Untitled-42-2.png)

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.

```bash
sc stop wuauserv
 sc query wuauserv
```

![Stopping wuauserv service](https://adamtheautomator.com/wp-content/uploads/2021/05/Untitled-43-2.png)

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._

```bash
sc pause apphostsvc
```

![Pausing service using SC pause ](https://adamtheautomator.com/wp-content/uploads/2021/05/Untitled-44-3.png)

Pausing service using SC pause

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

![Verifying AppHostSvc service pause ](https://adamtheautomator.com/wp-content/uploads/2021/05/Untitled-46-3.png)

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 continue`command. You’ll then see the service immediately goes back to a `RUNNING` state. `sc continue apphostsvc`

```bash
sc continue apphostsvc
```

![Continuing apphostsvc service](https://adamtheautomator.com/wp-content/uploads/2021/05/Untitled-47-2.png)

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.

```powershell
net stop BITS
```

> _Unlike the `sc` command, `net` can’t query the status of services._

![Stopping BITS service](https://adamtheautomator.com/wp-content/uploads/2021/05/Untitled-48-2.png)

Stopping BITS service

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

```bash
net start BITS 
```

![Starting BITS service ](https://adamtheautomator.com/wp-content/uploads/2021/05/Untitled-49-2.png)

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.

```bash
net pause AppHostSvc
net continue AppHostSvc
```

![Pausing AppHostSvc service ](https://adamtheautomator.com/wp-content/uploads/2021/05/Untitled-50-1.png)

Pausing AppHostSvc service

![Continuing AppHostSvc service](https://adamtheautomator.com/wp-content/uploads/2021/05/Untitled-51-1.png)

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_.

```powershell
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.

```bash
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](https://adamtheautomator.com/wp-content/uploads/2021/05/Untitled-52-1.png)

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/)?

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Fnet-stop%2F&text=Automate%20Service%20Management%20Through%20net%20stop%20and%20sc%20Command)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Fnet-stop%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Fnet-stop%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2022/09/How-to-Execute-PowerShell-Azure-Functions-with-HTTP-Triggers.jpg)

### [How to Execute PowerShell Azure Functions with HTTP Triggers](/azure-functions-powershell-2/)

Learn how to execute and test Azure Functions in PowerShell via HTTP using both the Azure Portal and PowerShell’s Invoke-RestMethod cmdlet.

![](https://adamtheautomator.com/wp-content/uploads/2022/09/Building-PowerShell-Azure-Functions-with-VS-Code-Series.png)

### [Building PowerShell Azure Functions with VS Code \[Series\]](/azure-functions-powershell-1/)

Running PowerShell in Azure Functions gives your scripts infinite resources and flexibility. Learn how to cloudify your PowerShell scripts with Azure Functions!

![](https://adamtheautomator.com/wp-content/uploads/2022/02/Autonomous-Persona-Management-using-1E-Tachyons-PowerShell-Toolkit.jpg)

### [Autonomous Persona Management using 1E Tachyon’s PowerShell Toolkit](/1e-powershell-3/)

Learn how to manage thousands of endpoints with dynamic tagging capabilities with 1E’s Tachon.

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
