Powershell

How to Enable and Disable Services Using PowerShell

Windows Services are applications without GUI that run in the background. The core function of the Windows Service is to make sure that the Windows OS is running smoothly. In case any of the Services is not functioning well then Windows automatically manages the services, such as it stops, suspends, and starts the services by itself. However, users can also manage the Windows service manually.

Windows Services are used to start or stop applications such as Printing, Networking, or Bluetooth. Services start working in the background when Windows boots up and stop working when the computer is turned off. An important thing to understand is that, when a service is disabled, its dependent services are also disabled, but when it is enabled, its dependent services are not restarted.

Quick Outline:

How to Enable and Disable Services Using PowerShell?

Windows services can be managed (enabled, or disabled) using a number of methods including Services app, Registry Editor, Group Policy Editor, Command Prompt, and PowerShell.

One of the precautions before disabling a service is to create a system restore before making any changes to the Windows services. So, in case of data loss, you can switch back to the backed-up state. If in case the system gets halted after disabling any Windows service. Then, enable and boot into the Safe Mode and enable the service.

However, users need to remember that disabling a service must not affect the Windows functionality.

Disable a Service on Windows Using PowerShell

Whenever a service is disabled in Windows, it does not start by itself (automatically) with the start of Windows. But it needs to be started manually. Normally, Windows services are enabled and disabled using the Services app. To do so check the stepwise instructions mentioned below.

Syntax

Here is the syntax of disabling a service on Windows using Powershell:

Set-Service -Name "Windows Service Name" -Status stopped -StartupType disabled

Important Note: Replace the “Windows Service Name” with the real service name you intend to disable.

For instance, let’s disable the Windows Backup service using PowerShell.

Step 1: Press Windows + X to open the Quick Access Menu and select Windows PowerShell (Admin) or Terminal(Admin):

Step 2: Type the mentioned command in the PowerShell console and press the Enter button to disable a service:

Set-Service -Name "SDRSVC" -Status stopped -StartupType disabled

According to the above code:

  • First, use the Set-Service command.
  • Assign the service name to be disabled to the -Name parameter.
  • Then, use the -Status parameter and specify the Stopped value to stop the service.
  • After that, use the -StartupType parameter and specify the disabled value to disable the service.

Enable a Service on Windows Using PowerShell

When a service is disabled it also stops working instantly. So, while enabling a service we need to make sure that it should start working right after it is enabled. To do so, we need to set its -Status to running and -StartupType to automatic.

Syntax

Here is the syntax for enabling a service on Windows using PowerShell:

Set-Service -Name "Windows Service Name" -Status running -StartupType automatic

Note: Replace the “Windows Service Name” with the service name you want to enable and the rest of the command will remain the same.

Step 1: Press Windows + R to launch the Run application.

Step 2: Type PowerShell and press Ctrl + Shift + Enter to open PowerShell as an administrator:

Step 3: Execute the mentioned command in the PowerShell console to enable a service:

Set-Service -Name "SDRSVC" -Status running -StartupType automatic

Bonus Tip: How to Start a Service Using PowerShell (Not Enable)

PowerShell not only enables the services but it can also start the services individually that are stopped manually or automatically. To start a service on Windows using PowerShell, check the mentioned instructions.

Syntax

Here is the syntax to start a service on Windows using PowerShell:

Start-Service -Name "Windows Service Name"

Step 1: Open the PowerShell application as an administrator:

Step 2: Run the mentioned command in the console to start a service using PowerShell:

Start-Service -Name "SDRSVC"

Bonus Tip: How to Stop a Service Using PowerShell (Not Disable)

If a service on Windows causes problems such as high CPU usage, making the system speed slow, or interfering with other services then that service can be stopped from running temporarily. However, it will restart when the system reboots.

Syntax

Here is the syntax to stop a service on Windows using PowerShell:

Stop-Service -Name "Windows Service Name" -Force

Note: The -Force parameter will stop the dependency services as well.

Step 1: Start PowerShell as an administrator:

Step 2: Type the mentioned command in the console to stop a Windows service using PowerShell:

Stop-Service -Name "SDRSVC" -Force

Bonus Tip: How to Enable and Disable Services Using Command Prompt (CMD)?

Similar to PowerShell, the Command Prompt is also a command line tool. Command Prompt can also be used to enable and disable service on Windows. However, its syntax is a bit different than PowerShell except for the service name.

Command Prompt has two commands that can stop, start, disable, or enable the services on Windows. One is NET and the other is SC. Both the commands have the same functionality, i.e., to manage Windows services, but net is the older one and sc is the newer command.

The core difference between both of the commands is that NET waits for the service to fully start or stop before returning its control to the Command Prompt. On the other hand, the SC command does not wait for the service, instead, it sends the control to the service before its return to the Command Prompt. But, in this very article, we will be using the SC command to enable or disable services because it is the new command for managing Windows services.

Disable a Service Using Command Prompt

In Windows, users can also disable a Service using CMD. To disable the service using Command Prompt, check the mentioned instructions.

Syntax

Here is the syntax to disable the service on Windows using Command Prompt:

sc stop "Windows Service Name" && sc config "Windows Service Name" start=disabled​

Note: Replace the “Windows Service Name” with the intended service name to be disabled on both occasions.

Step 1: Launch Command Prompt from the Windows Start menu:

Step 2: Type the mentioned command in the CMD console and press Enter:

sc stop "SDRSVC" && sc config "SDRSVC" start=disabled​

Enable a Service on Windows Using the Command Prompt

Disabled Windows services can also be enabled by using CMD. To do so, check the steps mentioned below.

Syntax

Here is the basic CMD syntax to enable the service on Windows:

sc config "Windows Service Name" start = auto && sc start "Windows Service Name"

Note: Replace the “Windows Service Name” with the real service name.

Step 1: Launch Command Prompt (CMD) on Windows.

Step 2: Run the below-given command in the CMD console to enable the service on Windows:

sc config "SDRSVC" start = auto && sc start "SDRSVC"

Conclusion

To disable the service on Windows using PowerShell, execute this command Set-Service -Name “Windows Service Name” -Status stopped -StartupType disabled. Replace the “Windows Service Name” with the real service name. To enable the service, execute this command Set-Service -Name “Windows Service Name” -Status running -StartupType automatic. Additionally, instead of enabling or disabling, services can be stopped and started individually using PowerShell, to do so read the above guide. Furthermore, the method to enable and disable service on Windows using Command Prompt (CMD) is also added in the above guide.

About the author

Muhammad Farhan

I am a Computer Science graduate and now a technical writer who loves to provide the easiest solutions to the most difficult problems related to Windows, Linux, and Web designing. My love for Computer Science emerges every day because of its ease in our everyday life.