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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: