How to Check if a Service is Running in Windows
Service management is a common task for developers and sys admins. When working in the terminal, you may need to quickly get a glance at the running service or check if a specific service is running.
This tutorial will show you quick methods and techniques for checking whether a service is running using Windows PowerShell.
Using Get-Service
cmdlet.
The Get-Service
cmdlet is a PowerShell cmdlet that allows you to retrieve information about services on a local or remote computer. It can be used to display the status, configuration, and other information about services.
We can use it to check for running services and then filter by the name of the service we wish to check.
For example, to check if the Windows Update Service
is running, we can run the command:
Get-Service wuauserv | Where-Object {$_.Status -eq "Running"}
If the service is running, the command above should return the details of the service as shown:
Status Name DisplayName
------ ---- -----------
Running wuauserv Windows Update
However, if the service is not running, the command should return an empty list.
If you want to check the status of the service and don’t need the full information, you can use the -Status
parameter instead:
Get-Service -Name WLAN* -Status Running
This will return only the names of the running services that match the specified name.
Conclusion
This short tutorial showed you how you can use the Get-Service
cmdlet in Windows PowerShell to check is a given service is running.