How to List All Windows Services using PowerShell or Command Line
Helps you diagnose any issues swiftly
The running applications you see on your screen are a fraction of what is happening in Windows. From managing device drivers to ensuring security, a bunch of background processes maintain a functioning Windows PC.
For any system administrator overseeing multiple computers, it is important to be able to view the status of these critical services. The Task Manager approach is too slow for this, and you cannot automate it with a script.
The solution? Command-line tools. Using theCommand Prompt or PowerShell, you can quickly get a read on the operational Microsoft services running on a system, helping you diagnose any issues swiftly.
Listing Windows Services In the Command Prompt
While not as flexible or powerful as Windows PowerShell,the Command Promptis still an excellent tool for system administrators. You can use thequeryexcommand to get the status of both active and disabled services and thenuse the taskkill commandto end pesky processes.
sc queryex type=service state=all
sc queryex type=service state=all | find /i “SERVICE_NAME:”
sc queryex type=service state=inactive
sc query DeviceInstall
Listing Windows Services in PowerShell
PowerShellis meant to be a dedicated command-line shell for modern Windows. As such, it provides access to pretty much every operating system component through commands, and Windows services are no exception.
PowerShell’s advantage is that you can automate it easily. All PowerShell commands can be compiled into complex scripts, allowing you to set up system administration tasks on multiple PCs without hassle.
Get-Service | Out-File “C:\logs\All_Services.txt”
Get-Service CryptSvc, COMSysApp
Get-Service | Where-Object {$_.Status -EQ “Running”}
Any complex process is split into multiple interdependent services. This is why simply getting the status of a particular service is often not enough. You also need to check the status of the services that service is dependent on.
Get-Service -Name CryptSvc –RequiredServices
Get-Service -Name CryptSvc -DependentServices
These two flags are crucial in writing scripts to automatically start or stop Windows services, as they give you a way to keep track of all the services connected with the affected service.
The PowerShell method is not limited to local computers. You can use the Get-Service cmdlet with the same syntax described above to query the processes of remote PCs as well. Just append the-ComputerNameflag at the end to specify which remote computer to retrieve information from.
Here’s an example:
get-service CryptSvc -ComputerName Workstation7
Managing Windows Services in PowerShell
Getting the status of services isn’t the only thing you can do in Windows PowerShell. As a full-fledged scripting environment, it provides script alternatives to all GUI options.
Powershell cmdlets can stop, start, restart, or even modify services. Paired with automatedGet-Servicecommands, PowerShell scripts can be written to fully automate everyday system management tasks.
Stop-Service -Name Spooler
Start-Service -Name Spooler
Restart-Service -Name Spooler
Set-Service ‘Spooler’ -StartupType Disabled
What Is the Best Way to List Windows Services?
Whether you are running Windows 10 or a Windows Server, being able to view a list of all Windows services can be handy. You can diagnose issues with critical system functions orstop unnecessary Microsoft servicesto improve performance.
For this purpose, PowerShell is the best option. While you can obtain a service list in Command Prompt, the additional functionality provided by PowerShell is more useful.
You can use PowerShell cmdlets to get the service status of Windows processes, filtering them by their status or other parameters. It is also easy to determine dependent services and start or stop them as required.
Levin Roy is a software engineer who loves writing about technology. Whether it is Windows tips-and-tricks or in-depth guides about application development, Levin uses his practical experience and technical skills to create articles that can help solve tricky problems.Read Levin’s Full Bio
Leave a Reply
Your email address will not be published.Required fields are marked*
Comment*
Name*
Email*
Website
Welcome to Help Desk Geek- a blog full of tech tips from trusted tech experts. We have thousands of articles and guides to help you troubleshoot any issue. Our articles have been read over 150 million times since we launched in 2008.
HomeAbout UsEditorial StandardsContact UsTerms of Use
Copyright © 2008-2024 Help Desk Geek.com, LLC All Rights Reserved