HTML Conditaional formatting

Function Get-Diskinfo { 
Clear-Content "c:\Scripts\comps.txt" 
Clear-Content "C:\Users\administrator.CONTOSO\Desktop\UnreachableHosts.txt"
[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().domains.DomainControllers.Name | Out-File "c:\Scripts\comps.txt"  
$computername = Get-Content "c:\Scripts\comps.txt" -ReadCount 0 
$ErrorActionPreference = "Stop"
foreach ($computer in $computername) 
{ 
Try{
Get-WmiObject Win32_LogicalDisk -filter "DriveType=3" -computer $computer | 
Select SystemName,DeviceID,@{Name="Size(GB)"; 
Expression={"{0:N1}" -f($_.size/1gb)}},@{Name="FreeSpace(GB)"; 
Expression={"{0:N1}" -f($_.freespace/1gb)}},@{Name="LOW SPACE"; 
Expression={"{0:N1}" -f($_.freespace / $_.size -lt .2)}}  
 }
Catch 
{
Add-Content "$computer is not reachable" -path C:\Users\administrator.CONTOSO\Desktop\error.txt
}
}}  
$a = ""
$a = $a + "BODY{background-color:#95B9C7;font-family:Calibri;font-size:10pt;}"
$a = $a + "TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}"
$a = $a + "TH{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:thistle}"
$a = $a + "TD{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:palegoldenrod}"
$a = $a + ""
Get-Diskinfo | ConvertTo-HTML -Head $a | out-file c:\Scripts\DCs.htm 

Above code is working fine. Want to add Color Red when False becomes True on Lowspace.

I’d suggest looking at our free eBook, “Creating HTML Reports in PowerShell.” I wrote a module that makes this kind of conditional formatting easier, and the ebook contains an example of exactly that. You’ll also have to do a lot less manual HTML creation like you’re doing - my module handles most of it, with a lot of dynamic display options.