Listing windows services statuses with Powershell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
$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" } |