Author Posts

January 1, 2012 at 12:00 am

by biblo45 at 2013-02-04 07:30:25

Hi all,
I have following script:
$a = "

"
##############################
$logfile = "c:\scripts\dcdiag_all_output.log"
$allDCs = @("xx","yy","zz")
foreach ($item in $alldcs)

{
Dcdiag.exe /v /s:$item >> $logfile

#New-Variable "results$item" -force
#$c = $results + $item

$Results = New-Object Object
$Results | Add-Member -Type NoteProperty -Name "ServerName" -Value $item
#$TestCat = $Null
Get-Content "C:\scripts\dcdiag_all_output.log" | %{
Switch -RegEx ($_)
{
#"Running" { $TestCat = ($_ -Replace ".*tests on : ").Trim() }
"Starting" { $TestName = ($_ -Replace ".*Starting test: ").Trim() }
"passed|failed" { If ($_ -Match "passed") {
$TestStatus = "Passed"

} Else
{
$TestStatus = "Failed"

} }
}

If ($TestName -ne $Null -And $TestStatus -ne $Null)
{
$Results | Add-Member -Name $("$TestName".Trim()) -Value $TestStatus -Type NoteProperty -force
$TestName = $Null; $TestStatus = $Null
}
New-Variable "last$item" -force -Value $results

}

}

$11 = $lastXX| ConvertTo-Html -Fragment
$22 = $lastYY | ConvertTo-Html -Fragment
$33 = $lastZZ | ConvertTo-Html -Fragment

ConvertTo-Html -head $a -Body "$11 $22 $33" -as table | out-file "C:\scripts\final.html"

Remove-Item C:\scripts\dcdiag_all_output.log

That script outputs following html output:

a user uploaded image

What i want is to mark as red for failed rows. But i could not find a proper way to achieve this. Can somebody point me?
Thanks.

by DonJ at 2013-02-04 07:37:36

You would add a class attribute, such as class="red", to the

or