Link to home
Start Free TrialLog in
Avatar of Stevolee
StevoleeFlag for United Kingdom of Great Britain and Northern Ireland

asked on

How do I highlight failed result in powershell

Hi,

I am currently writing some powershell code to list services running on a server, everthing is working I can create an HTML page using "convertto-html" to generate all services running in black. However, I need to output stopped services in orange or red.

I have attached the css code in powershell, I don't want to create the tables manually using HTLM since convertto-html can do the job easily.

I am using the command below to generate the html:
$myColSvc | ConvertTo-Html -head $a body "Service Report" | Out-File -Append $filelocation

 
$a = "<style>"
$a = $a + "body{color:#FFFFFF;background-color:#1270A6;font-size:10pt;font-family:'trebuchet ms', helvetica, sans-serif;font-weight:normal;padding-:0px;margin:0px;overflow:auto;}"
$a = $a + "a{font-family:Tahoma;color:Orange;Font-Size:10pt display: block;}"
$a = $a + "table,td,th {font-family:Tahoma;color:Black;Font-Size:10pt}"
$a = $a + "th{font-weight:bold;background-color:#CCCCCC;}"
$a = $a + "td {background-color:white;text-align: center}"
$a = $a + "</style>"

Open in new window

SOLUTION
Avatar of level9wizard
level9wizard
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Stevolee

ASKER

Hi,
Thanks for the updayte. However, I need to pass the css parameters to "convertto-html" I guess you are right I need an expert on powershell then. Please can anyone with ps skill help resolve....
 
 
 
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial