HI
How would I change the font color to red in an HTML report if the PercentageFree is less than 10 %
a = "<style>"
$a = $a + "body {background-color:Ivory; font-family:Tahoma; font-size:12pt;}"
$a = $a + "td, th {border:1px solid black; border-collapse:collapse;}"
$a = $a + "th {color:white; background-color:Green;}"
$a = $a + "table, tr, td, th {padding: 2px; margin: 0px}"
$a = $a + "table {margin-left:70px;}"
$a = $a + "</style>"
##Function to get percentage of datastore free space
####################################################
function CalcPercent {
param(
[parameter(Mandatory = $true)]
[int]$InputNum1,
[parameter(Mandatory = $true)]
[int]$InputNum2)
$InputNum1 / $InputNum2*100
}
$datastores = Get-Datacenter "ECC-MTB (Martinsburg)" | Get-Datastore | Where-Object {$_.Name -notlike "DataStore1*"}
ForEach ($ds in $datastores)
{
if (($ds.Name -match "Shared") -or ($ds.Name -match ""))
{ $PercentFree = CalcPercent $ds.FreeSpaceMB $ds.CapacityMB
$PercentFree = "{0:N2}" -f $PercentFree
$ds | Add-Member -type NoteProperty -name PercentFree -value $PercentFree
}
}