Get-Service - Checking Windows Services Status With PowerShell - TheITBros
Get-Service - Checking Windows Services Status With PowerShell - TheITBros
Home Windows PowerShell Get-Service: Checking Windows Services Status with PowerShell
The built-in Get-Service PowerShell cmdlet can be used to get a list of Windows services, check
their statuses, filter them by name or service status. Let’s learn how to use Get-Service to check
Windows services.
Contents ADVERTISEMENT
When run without parameters, the Get-Service command displays a list of all the services on the
local computer and their statuses.
To check whether the specific service is running or not, specify its name or DisplayName:
Get-Service wuauserv
Or
If you don’t know the exact name of the service, you can use wildcards. For example, to list all
services whose display name starts with Microsoft:
Use the Where-Object cmdlet to list only services with a specific state. For example, list all
stopped services:
Status — Indicates the current service status. The possible values are: Stopped,
StartPending, StopPending, Running, ContinuePending, PausePending, Paused.
However, other service object properties are not displayed. You can see them all by running the Check Out Our Recommendations Curate
for You
command below: DiscoveryFeed
Among these other properties, the most preferred when checking the service status is the
StartType, which indicates whether the service start type is:
List services that should start automatically but are not currently running:
Get-Service | Where-Object { $_.StartType -eq 'Automatic' -and $_.Status -ne 'Running' } | Select
-Object Status, Name, DisplayName, StartType
Get service dependency. Such services may fail to start if their dependent services are not
running:
According to the result below, the Dfs service has six dependencies, and one is not running
(Stopped), which is the RemoteRegistry. Ad
Check Services on a Remote Computer with PowerShell
The Get-Service cmdlet retrieves the service status in the local computer by default. But it is
capable of getting the service status on a remote computer.
On Windows PowerShell, the Get-Service cmdlet has a parameter called -ComputerName that
accepts an array of computer names to query. This method uses the Distributed Component
Object Model (DCOM) to connect to the remote machine and execute the command against it.
For example, this command retrieves the status of the services on the remote computers named
DC1 and PCX.
On PowerShell Core (6.x+), the -ComputerName parameter has been removed from the Get-
Service cmdlet because of PowerShell Core’s move away from DCOM. Instead, you must use the
Invoke-Command cmdlet, which uses the WinRM to communicate to remote machines.
The Get-Service PowerShell cmdlet is an easy and powerful way to check the status of Windows
services on local or remote computers. It can easily replace the old-school ways of managing
services using the Services MMC snap-in (services.msc) or the sc query console command.
POWERSHELL
Our newsletter is full of great content!
Subscribe TheITBros.com newsletter to get the latest content via email.
SUBSCRIBE!
3
Cyril Kardashevsky
I enjoy technology and developing websites. Since 2012 I'm running a few of
my own websites, and share useful content on gadgets, PC administration
and website promotion.
1 COMMENT
LEAVE A COMMENT
Your Comment
Name* Email*
Save my name, email, and website in this browser for the next time I comment.
SUBMIT
This site uses Akismet to reduce spam. Learn how your comment data is processed.