[Powershell] Get System Services Sorted into Running and Stopped 11-26-2011, 12:30 PM
#1
Code:
$Services_ = Get-Service | write-output
$running = 1; $stopped = 1
write-host
write-host "#" Running Services "#" -foregroundcolor "magenta"
foreach ($objItm in $Services_) {
$Display_ = $objItm.DisplayName
If ($objItm.Status -eq "Running") {
write-host " "$running")" $objItm.Name "("$Display_")" -foregroundcolor "white"
$running += 1
}
}
write-host
write-host "#" Stopped Services "#" -foregroundcolor "magenta"
foreach ($objItm in $Services_) {
$Display_ = $objItm.DisplayName
If ($objItm.Status -eq "Stopped") {
write-host " "$stopped")" $objItm.Name "-- ("$Display_")" -foregroundcolor "white"
$stopped += 1
}
}
write-host "-------------------------------------------------------------------" -foregroundcolor "magenta"
write-host "#" There are a Total of ($running -1) Running Services, and ($stopped -1) Stoppped Services -foregroundcolor "magenta"
write-host "-------------------------------------------------------------------" -foregroundcolor "magenta"
write-hostHere's another script I created which will display all of your systems currently running services and stopped services. use it as a commandlet for faster accessibility.
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]
![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)