# get the service data to use: # generate the service information to use # (requires PowerShell 5 because prior to PowerShell 5, Get-Service does not supply # StartType - alternative: use Get-WmiObject -Class Win32_Service, and adjust # property names)
# IMPORTANT: run this information through Select-Object to get a cloned copy # of the original objects so that style information can be appended $services = Get-Service | Select-Object-Property DisplayName, Status, StartType | Sort-Object-Property DisplayName
# define style to use for highlighting Style -Name HighlightedService -Color Red -BackgroundColor Yellow -Bold
# apply a different format to cell "Status" for all objects where # status is "Stopped" and StartType is "Automatic" $services | Where { $_.Status -eq'Stopped'-and$_.StartType -eq'Automatic'} | Set-Style-Property Status -Style HighlightedService