Get-Wmiobject -Query “select * from win32_service where name=’ServiceName'” -Computername Server01

You can use the following examples for providing multiple server names as input.

Get-Wmiobject -Query “select * from win32_service where name=’MSExchangeIS'” -Computername Server01, Server02

Get-WmiObject -Query “Select * from Win32_service where name = ‘MSExchangeIS'” -computername (gc ServerList.txt) | ft __Server,Name,State,Status

You can also find all the ‘Automatic services’ that are not running across multiple servers.

Get-WmiObject -Query “Select * from Win32_service” -computername (gc ServerList.txt)| ? {$_.state -ne ‘running’ -and $_.startmode -eq ‘auto’} |  ft __Server,name,startmode,state

Thanks to my friend Sarvesh for the tip.

– Thanks, Jinesh.

Advertisements