PowerShell provides the Get-Service
command in order to list or display services on Windows computers. The Get-Service command can be used to list services on remote computers. We should use the -ComputerName
attribute by providing the computer names or IP addresses of the remote systems.
Get Services on Remote Computers
We can use the Get-Service command in order to list remote computer services. In the following example, we list services of 192.168.1.10.
PS> Get-Service -ComputerName 192.168.1.10
Alternatively, we can provide the remote computer name instead of the IP address like below to list services.
PS> Get-Service -ComputerName server1.windowstect.com
Get Running Services on Remote Computers
We can get only the running services of the remote computers by using the Get-Service command.
PS> Get-Service -ComputerName 192.168.1.10 | Where-Object {$_.Status -eq "Running"}
Get Stopped Services on Remote Computers
We can get only the stopped services of the remote computers by using the Get-Service command.
PS> Get-Service -ComputerName 192.168.1.10 | Where-Object {$_.Status -eq "Stopped"}
Filter and Display Services on Remote Computers
While displaying remote computer services we can filter the services according to their names. In the following example, we filter and display services whose names contain “win”.
PS> Get-Service "*win*" -ComputerName 192.168.1.10