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 the Command 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 Prompt is still an excellent tool for system administrators. You can use the queryex command to get the status of both active and disabled services and then use the taskkill command to 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
PowerShell is 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”}
Checking Service Dependencies
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.
Listing Windows Services On Remote Computers
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 -ComputerName flag 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 automated Get-Service commands, 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 or stop unnecessary Microsoft services to 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.