How to Manage Services from PowerShell or Command Prompt.

This tutorial contains instructions on how you can stop, start or manage Windows Services from PowerShell or Command Prompt.

As you know, Windows services are a set of various “special” programs that run in the background and are necessary for the proper functioning of the operating system, installed applications and device drivers.

If for any reason a Windows service does not work properly or creates problems in the operation of the computer, then it is necessary to manage it (enable, disable, restart, stop or start it), in order to solve the problem.

To manage Windows services, you can either use the Windows interface (GUI), or use commands in PowerShell or Command Prompt. Since, in a previous article, I showed the common ways of managing Windows services via GUI, in this article I will show you how to manage services from Command Prompt and PowerShell.

How to Stop, Start, Enable or Disable Services from PowerShell.

In order to manage a service from PowerShell (or Command Prompt), you need to know its Display Name or the Service name. You can find that information either by looking in service’s properties in Services console (services.msc), or from PowerShell as descripted below.

How to Manage Services from PowerShell or Command PromptHow to Manage Services from PowerShell or Command Prompt

1. Open PowerShell as Administrator.

2. Give the below PowerShell command to see a list of all Windows Services, and to view their Name (service name) and the Display Name.

  • Get-Service | Format-Table -Auto

View Services from PowerShell commandView Services from PowerShell command

2. To Stop a Service in PowerShell, give one of the following commands:

  • Stop-Service -Force -Name “Display name
  • Stop-Service -Force -Name “Service name
  • Set-Service -Name “Service name” -Status Stopped

Example: To stop the “Windows Update” service (wuauserv) from PowerShell, give one of these commands:

  • Stop-Service -Force -Name “windows update”
  • Stop-Service -Force -Name “wuauserv”
  • Set-Service -Name “wuauserv” -Status Stopped

stop service powershell commandstop service powershell command

3. To Start a Service in PowerShell, give one of the following commands:

  • Start-Service -Name “Display name
  • Start-Service -Name “Service name
  • Set-Service -Name “Service name” -Status Running

Example: To start the “Windows Update” service (wuauserv) from PowerShell, give one of these commands:

  • Start-Service -Name “windows update”
  • Start-Service -Name “wuauserv”
  • Set-Service -Name “wuauserv” -Status Running

start service powershell commandstart service powershell command

4. To restart a service from PowerShell, give one of these commands:

  • Restart-Service -Force -DisplayName “Display name
  • Restart-Service -Force -Name “Service name

Example: To restart the “Windows Update” service (wuauserv) from PowerShell, give one of these commands:

  • Restart-Service -Force -DisplayName “windows update”
  • Restart-Service -Force -Name “wuauserv”

restart service powershell commandrestart service powershell command

5. To Disable a Service from PowerShell, give the following command:

  • Set-Service -Name “Service name” -StartupType Disabled

Example: To disable the “Windows Update” service (wuauserv) from PowerShell, give this command:

  • Set-Service -Name “wuauserv” -StartupType Disabled

disable service powershell commanddisable service powershell command

6. To Enable a service and to change the Startup type of a service to Manual give this command in PowerShell.

  • Set-Service -Name “Service name” -StartupType Manual

Example: To set the startup of “Windows Update” service (wuauserv) to Manual from PowerShell, give this command:

  • Set-Service -Name “wuauserv” -StartupType Manual

enable service powershell commandenable service powershell command

7. To Enable a service and to change the Startup type of a service to Automatic give this command in PowerShell.

  • Set-Service -Name “Service name” -StartupType Automatic

Example: To set the startup of “Windows Update” service (wuauserv) to Automatic from PowerShell, give this command:

  • Set-Service -Name “wuauserv” -StartupType Automatic

change service startup type powershell commandchange service startup type powershell command

 

 

How to Manage Services from Command Prompt or PowerShell.*

* Note: The following instructions work in both Command Prompt and PowerShell.

To manage services from the command line, you can use the NET command or the SC command. he main difference between these commands is that the NET command only gives you the options to stop or start a service, while the SC command also allows you to enable or disable services.

1. Open Command Prompt as Administrator (or PowerShell as Administrator).

2. Type the following NET command in command prompt to view all running services with their Display Name of all running services. *

* Notes:
1. In order to manage a service from command prompt you must know its Display Name or the Service name.
2. The net start command shows only the running services with their Display Name. If you want to manage a service that is not started, then open the Services Console (services.msc), and then open the service’s properties to view its Display Name or the Service name.

  • net start

View-List Running Services from command promptView-List Running Services from command prompt

3. To Stop a service with the net command, give one of the following commands:

  • net stop “Display Name
  • net stop Service-Name
  • sc stop Service-Name

Example: To stop the “Windows Update” service (wuauserv) from command prompt, give one of these commands:

  • net stop  “windows update”
  • net stop wuauserv
  • sc stop wuauserv

Stop service from command promptStop service from command prompt

4. To Start a service with the net command, give one of the following commands:

  • net start “Display Name
  • net start Service-Name
  • sc start Service-Name

Example: To start the “Windows Update” service (wuauserv) from command prompt, give one of these commands:

    • net start  “windows update

 

    • net start wuauserv

 

  • sc start wuauserv

Start Service from COmmand PromptStart Service from COmmand Prompt

5. To Disable or to change the Startup type of a service (e.g. to Automatic, Manual) in Command prompt or in PowerShell with the sc command, type: *

  • sc config “Service Name” start=auto
  • sc config “Service Name” start=delayed-auto
  • sc config “Service Name” start=demand
  • sc config “Service Name” start=disabled

Note: Where: auto=Automatic, delay-auto=Automatic (Delayed Start, demand=Manual, disabled=Disabled

Example: To change the startup type of the Windows Update service (wuauserv) use these commands:

  • sc config “wuauserv” start=auto
  • sc config “wuauserv” start=delayed-auto
  • sc config “wuauserv” start=demand
  • sc config “wuauserv” start=disabled

Configure Service Startup Type command promptpConfigure Service Startup Type command promptp

That’s all folks! Did it work for you?
Please leave a comment in the comment section below or even better: like and share this blog post in the social networks to help spread the word about this solution.

If this article was useful for you, please consider supporting us by making a donation. Even $1 can a make a huge difference for us.

Hình ảnh thuộc sở hữu của trang web qnet88.comHình ảnh thuộc sở hữu của trang web qnet88.com

Đánh giá post
[related_posts_by_tax posts_per_page="6" title="Bài liên quan" taxonomies="category,post_tag"]

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *

Hotline: 0974.0707.83(Zalo/Viber)