get-service | ConvertTo-Html -Property Name,Status | foreach {
if ($_ -like "*<td>Running</td>*") {$_ -replace "<tr>", "<tr bgcolor=green>"}
else {$_ -replace "<tr>", "<tr bgcolor=red>"}} > c:get-service.html
The result:For a normal consult:
If you want start one service down automaticaly
Get-Service BITS | %{ if ( $_.Status -eq "Stopped" ) {Start-Service BITS}}
More important info at: https://www.techedge.nl/2018/04/09/servers-and-service-status-indicator-via-powershell/
by GoN | Published: February 15, 2018 | Last Updated: April 10, 2018