get-services | where ( $_.status -eq ‘running’ )

Get-Service | Where-Object { $_.canPauseandContinue }

 

get-service | ConvertTo-Html -Property Name,Status | foreach { 

if ($_ -like “*<td>Running</td>*”) {$_ -replace “<tr>”, “<tr bgcolor=green>”} 

else {$_ -replace “<tr>”, “<tr bgcolor=red>”}} > .\get-service.html 

get-service | ConvertTo-Html -title “MailServer EX01” -body (get-date) ` -pre “<P>Generated by Corporate IT</P>” -post ” <P>For details, contact Corp.IT at ` <a href=http://infoweb> http://infoweb </a>.</P>.” –Property Name, Status | foreach { if ($_ -like “*<td>Running</td>*”) {$_ -replace “<tr>”, “<tr bgcolor=green>”} ` elseif ($_ -like “*<td>Stopped</td>*” ) {$_ -replace “<tr>”, “<tr bgcolor=red>”} else { $_ } } > .\ServiceStatus.html