- Start or stop Windows service from command line (CMD)
- Command: net stop wuauserv says service is starting or stopping
- Is it possible to log who started or stopped a windows service?
- 5 Answers 5
- Not the answer you’re looking for? Browse other questions tagged c# windows-services or ask your own question.
- Linked
- Related
- Hot Network Questions
- Subscribe to RSS
- How to start and stop services manually on Windows 10
- How to manage services using Services console
- Stop service
- Start service
- Disable service
- Enable service
- How to manage services using Task Manager
- How to manage services using PowerShell
- Stop service
- Start service
- Disable service
- Enable service
- How to manage services using Command Prompt
- Stop service
- Start service
- Disable service
- Enable service
- More Windows 10 resources
- The Dell XPS 15 is our choice for best 15-inch laptop
- Halo: MCC’s live service elements make it better, not worse
- Microsoft’s Surface Duo is not ‘failing up’
- These are the best PC sticks when you’re on the move
Start or stop Windows service from command line (CMD)
We normally use Services.msc to start or stop or disable or enable any service. We can do the same from windows command line also using net and sc utilities. Below are commands for controlling the operation of a service.
Command to stop a service:
To start a service:
You need to have administrator privileges to run net start/stop commands. If you are just a normal user on the computer, you would get an error like below.
To disable a service:
To enable a service:
To make a service start automatically with system boot:
Note: Space is mandatory after ‘=’ in the above sc commands.
This SC command works on a Windows 7 machine and also on the down-level editions of Windows i.e Windows XP/2003 and Windows Vista. Again, if you do not have administrator previliges you would get the below error.
Note that the service name is not the display name of a service. Each service is given a unique identification name which can be used with net or sc commands. For example, Remote procedure call (RPC) is the display name of the service. But the service name we need to use in the above commands is RpcSs.
So to start Remote procedure call service the command is:
These service names are listed below for each service. The first column shows the display name of a service and the second column shows the service name that should be used in net start or net stop or sc config commands.
Command: net stop wuauserv says service is starting or stopping
Hi ! I had some issues with windows update so I looked up some solutions and the one with running commands in cmd is only one but when I run the command: net stop wuauserv , it says the service is starting or stopping and same case is with command : net start wuauserv.
I have also tried the troubleshooter and trying to start the service from the list of services but the start stop are disabled and it shows as Stopping.
Thank you for posting in Microsoft Community.
We appreciate your efforts in trying to resolve the issue. Let me assist you fix the issue.
Please share this information to assist you better.
- Are you facing any issues with Windows update?
- What is the make and model of the computer?
- Which build is currently installed in your computer?
- Have you made any recent changes prior to this issue?
Try these steps manually to reset the Windows Updates Components once again and then reinitiate the Windows Update process.
Resetting Windows Update Components will fix corrupt Windows Update Components and help you to install the Windows Updates quickly.
Please follow the below steps to reset the Windows Updates Components:
1. Press Windows Key + X on the keyboard and then select “Command Prompt (Admin)” from the menu.
2. Stop the BITS, Cryptographic, MSI Installer and the Windows Update Services . To do this, type the following commands at a command prompt. Press the “ENTER” key after you type each command.
net stop wuauserv
net stop cryptSvc
net stop bits
net stop msiserver
3. Now rename the SoftwareDistribution and Catroot2 folder. You can do this by typing the following commands in the Command Prompt. Press the “ENTER” key after you type each command.
ren C:\Windows\SoftwareDistribution SoftwareDistribution.old
ren C:\Windows\System32\catroot2 Catroot2.old
4. Now, let’s restart the BITS, Cryptographic, MSI Installer and the Windows Update Services . Type the following commands in the Command Prompt for this. Press the ENTER key after you type each command.
net start wuauserv
net start cryptSvc
net start bits
net start msiserver
5. Type Exit in the Command Prompt to close it and then restart the computer.
6.After restarting the computer, now retry to install Windows Updates.
Hope this information helps. Reply to the post with an updated status of the issue so that we can assist you further.
Is it possible to log who started or stopped a windows service?
I have some windows services written in C#. When somebody stops or starts the service, I would like to be able to determine who it was and log that information.
I tried logging Environment.UserName but that evaluates to SYSTEM even on my local machine.
Also, for the time being these services are running on Windows 2000 server.
5 Answers 5
Within the Event Viewer (Control Panel | Administrative Tools | Event Viewer) on the System tab the Service Control Manager logs who started and stop each event. I’ve just tested this myself and viewed the results. This leads me to two things:
- You may be able to query or hook those events from the Service Control Manager as they happen, or
- You can definitely just query the Event Viewer’s «System» log to look for those events for your Service.
Hope that leads you to your solution.
- You can filter the System EventLog by Service Control Manager
Event ID 7040 — covers Service start type change (eg disabled, manual, automatic)
Event ID 7036 — covers Service start/stop
For others that have PowerShell, you can use this:
You can enable auditing according to this article
Additionally, it may be a good idea to alert email to yourself in OnStop() method.
There probably isn’t a way. Any of the normal .NET ways that you get at the environment’s user are going to return the user whose credentials the service runs with (which will typically be SYSTEM, LOCAL SERVICE, NETWORK SERVICE, etc).
How I’d probably do it is poll the system to see if a user is logged in, and assume that user did it. Of course, this discounts services that are shut down by the system for some reason (presumably your service would not be), and can only help you narrow it down if more than one user is logged in at one time (but then, you could always log both of them).
- Just open Event Viewer (Start menu -> Search «Event» Event Viewer will come, open it)
- Expand ‘Windows Log’ on Event viewer left menu.
- Click on Application. (It will show your application error with description in ‘general’ tab.
- Again try to start your service and from event viewer see what is exact cause for stopping briefly in ‘general’ tab.
Not the answer you’re looking for? Browse other questions tagged c# windows-services or ask your own question.
Linked
Related
Hot Network Questions
Subscribe to RSS
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.4.16.39093
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
How to start and stop services manually on Windows 10
Source: Windows Central
On Windows 10, services are programs that run in the background without a user interface and enable system features (such as printing, networking, remote access, File Explorer, Windows Search, updates, etc.) and apps to operate as intended.
Although the system does a pretty good job managing background services, sometimes, you may need to control them manually when a feature or app isn’t working correctly, or an app requires you to manage its services manually.
Whatever the case it might be, Windows 10 includes at least four methods to stop, start, disable, or enable services using the Services console, Task Manager, Command Prompt, and PowerShell.
In this Windows 10 guide, we’ll walk you through the steps to manage system and apps services on your computer.
How to manage services using Services console
Using the Services consoles is perhaps the simplest method to stop, start, disable, or enable one or multiple services on Windows 10.
Stop service
To stop a running service using Services, use these steps:
- Open Start.
- Search for Services and click the top result to open the console.
- Double-click the service that you intend to stop.
Click the Stop button.
Source: Windows Central
Quick tip: You can also manage the state by right-clicking the service and selecting the option. Or you can select the service and then use the controls at the top to start, stop, pause, or restart.
Once you complete the steps, the service will stop running on the device.
If you’re unable to stop a system service, consider that some services are required for the operation of Windows 10, and they can’t be stopped.
Start service
To start a service on Windows 10, use these steps:
- Open Start.
- Search for Services and click the top result to open the console.
- Double-click the service that you intend to stop.
Click the Start button.
Source: Windows Central
After you complete the steps, the service you specified will start for the current session.
Disable service
To set a service a disabled, use these steps:
- Open Start.
- Search for Services and click the top result to open the console.
- Double-click the service that you intend to stop.
- Click the Stop button.
Use the «Start type» drop-down menu and select the Disabled option.
Source: Windows Central
Once you complete the steps, the service will no longer start automatically after restarting your device.
Enable service
To enable a specific service, use these steps:
- Open Start.
- Search for Services and click the top result to open the console.
- Double-click the service that you intend to stop.
- Click the Start button.
Use the «Start type» drop-down menu and select the Automatic option.
These are the Startup types on Windows 10:
- Automatic – service starts at boot.
- Automatic (Delayed Start) – service start after boot.
- Manual – starts service manually as needed.
- Disabled – stops service from running.
Source: Windows Central
After you complete the steps, the Windows 10 or app service will enable, but if it was in a stopped state, you’d need to start it manually or restart the device for the service to run.
How to manage services using Task Manager
Task Manager also includes a section to quickly manage services for Windows 10 and apps.
To stop, start, or restart a service using Task Manager, use these steps:
- Open Start.
Search for Task Manager and click the top result to open the app.
Quick tip: Windows 10 includes many other ways to open the experience, including right-clicking the taskbar and selecting the Task Manager option and using the Ctrl + Shift + ESC keyboard shortcut.
Right-click the service name, and select one of the options:
- Stop.
- Start.
- Restart.
Source: Windows Central
Quick note: Task Manager only displays the service name, not the display name. For example, if you’re using this method, you’ll the «Print Spooler» defined as «Spooler.»
Once you complete the steps, the service will respond to the option you selected.
How to manage services using PowerShell
You can also use PowerShell commands to manage background services for Windows 10 and apps.
Stop service
To stop a specific service with PowerShell, use these steps:
- Open Start.
- Search for PowerShell, right-click the top result, and select the Run as administrator option.
(Optional) Type the following command to view a list of all the services and press Enter:
Source: Windows Central
Type the following command to stop a service and press Enter:
Stop-Service -Name «SERVICE-NAME»
For example, this command stops the printer spooler service on Windows 10:
Stop-Service -Name «spooler»
Source: Windows Central
In the command, replace «SERVICE-NAME» for the name of the service that you intend to stop. If you want to use the display name, replace -Name for -DisplayName and then specify the display name of the service.
Alternatively, you can also use this variant of the command to stop the service:
Set-Service -Name «SERVICE-NAME» -Status stopped
Source: Windows Central
In the command, replace «SERVICE-NAME» for the name of the service that you intend to stop. If you want to use the display name, replace -Name for -DisplayName and then specify the display name of the service. You only need the quotation marks if there’s a space within the name.
Quick tip: If you’re getting a dependency error, you can append the -force option in either of the commands to stop the service. For example, Stop-Service -Name «SERVICE-NAME» -Force .
After you complete the steps, the PowerShell command will stop the service on your device.
Start service
To start a Windows 10 or app service with PowerShell, use these steps:
- Open Start.
- Search for PowerShell, right-click the top result, and select the Run as administrator option.
Type the following command to start a service and press Enter:
Start-Service -Name «SERVICE-NAME»
For example, this command starts the printer spooler service on Windows 10:
Start-Service -Name «spooler»
Source: Windows Central
In the command, replace «SERVICE-NAME» for the name of the service. Using the display name is supported, replacing -Name for -DisplayName and then specify the display name of the service.
Alternatively, you can also use this variant of the command to start a service:
Set-Service -Name «SERVICE-NAME» -Status running
Source: Windows Central
In the command, replace «SERVICE-NAME» for the name of the service. If you want to use the display name, replace -Name for -DisplayName and then specify the display name of the service.
Once you complete the steps, the service will start on your computer.
Disable service
To disable a service using a PowerShell command, use these steps:
- Open Start.
- Search for PowerShell, right-click the top result, and select the Run as administrator option.
Type the following command to disable a service and press Enter:
Set-Service -Name «SERVICE-NAME» -Status stopped -StartupType disabled
In the command, update «SERVICE-NAME» for the name of the service. If you want to use the display name of the service, then replace -Name for -DisplayName and specify the service name. If you want to disable the service without stopping it immediately, you can remove the -Status stopped portion of the command.
For example, this command disables the printer spooler service on Windows 10:
Set-Service -Name «spooler» -Status stopped -StartupType disabled
Source: Windows Central
After you complete the steps, the PowerShell command will disable the specified service.
Enable service
To enable a specific background service with PowerShell, use these steps:
- Open Start.
- Search for PowerShell, right-click the top result, and select the Run as administrator option.
Type the following command to enable a service and press Enter:
Set-Service -Name «SERVICE-NAME» -Status running -StartupType automatic
For example, this command enables the printer spooler service using PowerShell:
Set-Service -Name «spooler» -Status running -StartupType automatic
Source: Windows Central
Quick note: You may able to use the display -DisplayName option, but the command may also prompt you to supply the name of the service, adding an extra step to the process. If you want to enable the service without starting it immediately, you can remove the -Status running portion of the command.
Once you complete the steps, PowerShell will enable the service specified with the command.
How to manage services using Command Prompt
If you’re comfortable using the command line, Command Prompt offers the «net» command (older) to stop or start, or the «sc» command (newer) to stop, start, disable, or enable services on Windows 10.
Stop service
To stop a Windows 10 or app service with Command Prompt, use these steps:
- Open Start.
- Search for Command Prompt, right-click the top result, and select the Run as administrator option.
(Optional) Type the following command to view a list of all the services and press Enter:
sc queryex state=all type=service
Source: Windows Central
Type the following command to stop a service and press Enter:
net stop «SERVICE-NAME»
In the command, replace «SERVICE-NAME» for the name or display name of the service. You only need the quotation marks if there’s a space within the name.
For example, this command stops the printer spooler using the service name:
net stop «spooler»
Source: Windows Central
Alternatively, you can also use the more advanced «sc» command:
sc stop «SERVICE-NAME»
For example, this command stops the printer spooler using the service name:
sc stop «spooler»
Source: Windows Central
After you complete the steps, the command will stop the specified service on Windows 10.
Start service
To start a service with the command line, use these steps:
- Open Start.
- Search for Command Prompt, right-click the top result, and select the Run as administrator option.
Type the following command to start a service and press Enter:
net start «SERVICE-NAME»
In the command, replace «SERVICE-NAME» for the name or display name of the service. You only need the quotation marks if there’s a space within the name.
For example, this command starts the printer spooler using the service name:
net start «spooler»
Source: Windows Central
Alternatively, you can also use the «sc» command:
sc start «SERVICE-NAME»
For example, this command starts the printer spooler using the service name:
sc start «spooler»
Source: Windows Central
Once you complete the steps, the command will execute and start the service you specified.
Disable service
To disable a service with Command Prompt, use these steps:
- Open Start.
- Search for Command Prompt, right-click the top result, and select the Run as administrator option.
Type the following command to disable a service and press Enter:
sc config «SERVICE-NAME» start=disabled
In the command, replace «SERVICE-NAME» for the name of the service that you want to disable.
For example, this command disables printer spooler using the service name:
sc config «spooler» start=disabled
Source: Windows Central
(Optional) Type the following command to stop the service and press Enter:
sc stop «SERVICE-NAME»
Quick note: When you disable a service, it doesn’t stop the current state of the service. You can either restart your computer or stop the service using the above command.
After you complete the steps, the sc command will run disabling the Windows 10 or app service you specified.
Enable service
To enable a service with a command, use these steps:
- Open Start.
- Search for Command Prompt, right-click the top result, and select the Run as administrator option.
Type the following command to enable a service and press Enter:
sc config «SERVICE-NAME» start=auto
In the command, replace «SERVICE-NAME» for the name of the service that you want to enable.
For example, this command enables the printer spooler automatically using the service name:
sc config «spooler» start=auto
Source: Windows Central
These are alternative commands to enable a particular service:
- Manual: sc config «SERVICE-NAME» start=demand
- Automatic Delayed: sc config «SERVICE-NAME» start=delayed-auto
(Optional) Type the following command to start the service and press Enter:
sc start «SERVICE-NAME»
Once you complete the steps, the service will enable and start automatically on reboot according to the command you used.
You can only use the «net» command to start or stop services. The «sc» command allows you to perform more tasks, including start, stop, enable, or disable services, among other options. If you’re choosing to manage services with command lines, then, in either case, it’s best to use the service name instead of the display name.
Also, when using any of the methods outlined above, consider that making modifications to the default settings can alter the operation of one or more features that depend on that service negatively affecting the experience. Furthermore, if you restart a service, you might be required to start its dependencies manually as well to make the app or feature operational again.
We’re focusing this guide on Windows 10, but the ability to manage services has been available for several years, which means that you can refer to this guide if you’re still running Windows 8.1, Windows 7, and older versions.
More Windows 10 resources
For more helpful articles, coverage, and answers to common questions about Windows 10, visit the following resources:
The Dell XPS 15 is our choice for best 15-inch laptop
For a lot of people, a 15-inch laptop is a perfect size that offers enough screen for multitasking, and in a lot of cases, some extra performance from powerful hardware. We’ve rounded up the best of the best at this size.
Halo: MCC’s live service elements make it better, not worse
Halo: The Master Chief Collection is more popular than ever, but some fans don’t agree with the live service approach 343 Industries has taken with it. Here’s why those elements are, at the end of the day, great for the game and for Halo overall.
Microsoft’s Surface Duo is not ‘failing up’
Microsoft announced this week that it was expanding Surface Duo availability to nine new commercial markets. While Surface Duo is undoubtedly a work in progress, this is not a sign of a disaster. It’s also doesn’t mean that Surface Duo is selling a ton either. Instead, the reason for the expansion is a lot more straightforward.
These are the best PC sticks when you’re on the move
Instant computer — just add a screen. That’s the general idea behind the ultra-portable PC, but it can be hard to know which one you want. Relax, we have you covered!