Check Services which are in StopPending State in Multiple Servers


Hi All,

Below is the PowerShell script for that.

## check the services in Servers which are in state stop pending state

$computers = "server1","server2"

$array =@()

foreach ($computer in $computers)

{

$obj =New-Object psobject

$Services = Get-Service -ComputerName $computer | where { $_.Status -eq “stoppending” }

Add-Member -InputObject $obj -MemberType NoteProperty -Name Servername -Value $computer -Force

Add-Member -InputObject $obj -MemberType NoteProperty -Name Services -Value $Services -Force

$array+=$obj

$obj=$null

}

$array| select servername, services|select -ExpandProperty services|select machinename,name

Regards,

Chaitanya

Leave a comment

Design a site like this with WordPress.com
Get started