ersin.fr
msgbartop
just my personal notebook…
msgbarbottom


27 Dec 16 Listing windows services statuses with Powershell

Advertisements
$stopingServices=Get-Service | Where-Object {$_.status -eq "stoping"}
$startingServices=Get-Service | Where-Object {$_.status -eq "starting"}
$runningServices=Get-Service | Where-Object {$_.status -eq "running"}
$stoppedServices=Get-Service | Where-Object {$_.status -eq "stopped"}


if($startingServices){
 Write-Host "`nStarting Services: $startingServices"
}
if($stopingServices){
 Write-Host "`nStoping Services: $stopingServices"
}
if($runningServices){
 Write-Host "`nRunning Services: $runningServices"
}
if($stoppedServices){
 Write-Host "`nStopped Services: $stoppedServices"
}

Tags: