NOTE: Welcome to the Knowledge Sharing Blog! If you encounter any errors during use, such as error in download link, slow loading blog, or unable to access a certain page on the blog … please notify me. via Contact page. Thanks!
Well, in this article I will detail you how to get a list of Services available on Windows and Windows Server.
In addition, I also share with you the most useful and used commands to help you manage services on Windows better …
An article is heavy on commands, but I think it will be very useful for those who like to explore and learn about Windows.
Read more:
I. How to open a command line window
You can use it CMD
or Powershell
are okay. Please run CMD or Powershell with administrative rights.
You may be looking for:
How to paste the command line, you just need to copy the command as usual => then right-click to execute the paste command.
II. How to use the command line to manage Serives on Windows
#first. How to get a list of Services available on Windows
You use the following command for Powershell:
- Get-Service | Select Name, DisplayName, Status, StartType
You use the following command for CMD:
- Powershell -ExecutionPolicy Bypass -Command “& Get-Service | Select Name, DisplayName, Status, StartType ”
#2. The command gets a list of running services (Running)
You use the following command for Powershell:
- Get-Service | Where {$ _. Status -eq ‘Running’} | Select Name, DisplayName, StartType
You use the following command for CMD:
- Powershell -ExecutionPolicy Bypass -Command “& Get-Service | Where {$ _. Status -eq ‘Running’} | Select Name, DisplayName, StartType ”
# 3. Commands to get a list of stopped services
You use the following command for Powershell:
- Get-Service | Where {$ _. Status -eq ‘Stopped’} | Select Name, DisplayName, StartType
You use the following command for CMD:
- Powershell -ExecutionPolicy Bypass -Command “& Get-Service | Where {$ _. Status -eq ‘Stopped’} | Select Name, DisplayName, StartType ”
# 4. The Stop Service command is running on Windows
Command structure to perform on or any a Services on Windows operating system.
We will rely on the list of Services above to enable / disable any one you want.
– You use the following command for Powershell:
- Stop-Service Name or DisplayName
For example, I want to turn off the service named Function Discovery Provider Host
then I will use the following command:
Or:
- Stop-Service ‘Function Discovery Provider Host’
– You use the following command for CMD:
- Powershell -ExecutionPolicy Bypass -Command “& Stop-Service ServiceName or DisplayName”
For example, if I want to turn off the service called Function Discovery Provider Host, I will use the following command:
- Powershell -ExecutionPolicy Bypass -Command “& Stop-Service fdPHost”
Or:
- Powershell -ExecutionPolicy Bypass -Command “& Stop-Service ‘Function Discovery Provider Host’“
# 5. The Start Service command is disabled on Windows
– You use the following command for Powershell:
- Start-Service Name or DisplayName
For example, if I want to turn off the service called Function Discovery Provider Host, I will use the following command:
Or:
- Start-Service ‘Function Discovery Provider Host’
– You use the following command for CMD:
- Powershell -ExecutionPolicy Bypass -Command “& Start-Service ServiceName or DisplayName”
For example, if I want to turn off the service called Function Discovery Provider Host, I will use the following command:
- Powershell -ExecutionPolicy Bypass -Command “& Start-Service fdPHost”
Or:
- Powershell -ExecutionPolicy Bypass -Command “& Stop-Service ‘Function Discovery Provider Host’“
# 6. Command Automatic (Delayed Start) / Automatic / Manual / Disabled Services on Windows
– You use the following command for Powershell:
- Set-Service Name or DisplayName -StartupType Automatic (Delayed Start) / Automatic / Manual / Disabled
For example, if I want to Disable a service called Function Discovery Provider Host, I will use the following command:
- Set-Service fdPHost -StartupType Disabled
Or:
- Set-Service ‘Function Discovery Provider Host’ -StartupType Disabled
– You use the following command for CMD:
- Powershell -ExecutionPolicy Bypass -Command “& Set-Service Name / DisplayName -StartupType Automatic (Delayed Start) / Automatic / Manual / Disabled”
For example, if I want to Disable a service called Function Discovery Provider Host, I will use the following command:
- Powershell -ExecutionPolicy Bypass -Command “& Set-Service fdPHost -StartupType Disabled”
Or:
- Powershell -ExecutionPolicy Bypass -Command “& Set-Service ‘Function Discovery Provider Host’ -StartupType Disabled”
# 7. Advanced configuration
You cannot re-enable the service while it is available Startup type
was Disabled.
Instead, you must use each of the following syntax:
– You use the following command for Powershell:
- Get-WMIObject win32_service | Where {$ _. Name -eq ‘Name / DisplayName’}
- Set-Service Name / DisplayName -StartupType Automatic (Delayed Start) / Automatic / Manual / Disabled
- Start-Service Name / DisplayName
For example if service Function Discovery Provider Host
have status stopped
and startup type disabled
If you want to turn it back on, you must use the following syntax:
- Get-WMIObject win32_service | Where {$ _. Name -eq ‘fdPHost’}
- Set-Service wscsvc -StartupType Automatic
- Start-Service fdPHost
– You use the following command for CMD:
- Powershell -ExecutionPolicy Bypass -Command “& Get-WMIObject win32_service | Where {$ _. Name -eq ‘Name / DisplayName’} ”
- Powershell -ExecutionPolicy Bypass -Command “& Set-Service Name / DisplayName -StartupType Automatic (Delayed Start) / Automatic / Manual / Disabled”
- Powershell -ExecutionPolicy Bypass -Command “& Start-Service Name / DisplayName”
For example:
- Powershell -ExecutionPolicy Bypass -Command “& Get-WMIObject win32_service | Where {$ _. Name -eq ‘wscsvc’} ”
- Powershell -ExecutionPolicy Bypass -Command “& Set-Service fdPHost -StartupType Automatic”
- Powershell -ExecutionPolicy Bypass -Command “& Start-Service fdPHost”
II. Download Powershell Script and Batch script files to quickly enable / disable Services
In the download folder will have 3 files that are (download here or here):
- Start-Service.ps1: Support to turn on Services is turned off.
- Stop-Service.ps1: Support to turn off services running.
- Service-Configuration.cmd: Customizable, there are 2 options for you. To run this batch file, you just need to double click to run it.
// Note: If you want to see the code, you can right click on the file you want to view => then select Edit is viewable code.
If you want to run the code, right-click on the file => and select Run with PowerShell
is done.
For example for you easy to imagine, now I will run the file test Start-Service.ps1
Please !
If you want to enable any services, please choose ID
(for example ID is 170) => then press Enter
to execute the command.
Note: Case if selected ID
If you choose which is not in the list above, it will display a message and ask if you want to continue? If you choose Y
the program will continue, if pressed N
will exit the program.
III. Epilogue
Well, above are the most commonly used commands to manage Services on Windows or Windows Server that you should know.
Hope this article will be useful to you. Good luck !
Kien Nguyen – techtipsnreview
Note: Was this article helpful to you? Don’t forget to rate, like and share with your friends and relatives!
Source: [Tuts] How to manage the Services (services) available on Windows
– TechtipsnReview