Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 8583

Changing color when the value reaches a set threshold

$
0
0
I erally need help with this. I have this block of code that is put into a html report.
I trying to change the color of the output on the free space only 
@{n='FreeSpace (GB)';e={"{0:n2}" -f ($_.freespace/1gb)}} 
when the size is equal to 10 or less. can it be done here ?
$DiskInfo= Get-WMIObject -ComputerName $computer Win32_LogicalDisk | Where-Object{$_.DriveType -eq 3} `
| Select-Object SystemName, DriveType, VolumeName, Name, @{n='Size (GB)';e={"{0:n2}" -f ($_.size/1gb)}}, @{n='Used Space (GB)';e={"{0:n2}" -f (($_.size-$_.freespace)/1gb)}}, @{n='FreeSpace (GB)';e={"{0:n2}" -f ($_.freespace/1gb)}}, @{n='PercentFree';e={"{0:n2}" -f ($_.freespace/$_.size*100)}} | ConvertTo-HTML -fragment

Viewing all articles
Browse latest Browse all 8583

Trending Articles