Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Change Color in HTML Output

$
0
0

Hello Folks,

i use the following script to collect some disk information of all my servers in the directory.

I want to change the Color off a cell if the Freespace % value is greater than 90%.

How can i solve this ?

Many thanks in advance. :)

Stefan

$Server = (Get-ADComputer -Filter {OperatingSystem -like "*Server*" -and Enabled -eq $TRUE } -Properties * | Where {Test-Connection $_.name -count 1 -quiet}|Sort-Object -Property $_.Name).Name


Get-WmiObject Win32_LogicalDisk -Computer $Server -Filter 'DriveType = 3' |
  select @{n='Hostname';e={$_.SystemName}},
         @{n='DriveLetter';e={$_.DeviceID -replace ':'}},
         @{n='VolumeLabel';e={$_.VolumeName}},
         @{n='FileSystemType';e={$_.FileSystem}},
         @{n='DiskSize';e={"{0}GB" -f [int]($_.Size/1GB)}},
         @{n='Freespace %';e={"{0}%" -f [int]($_.FreeSpace/$_.Size*100)}} |
ConvertTo-Html -Head '<style>th,td {text-align:center;}</style>' | out-file "$env:TEMP\report.html"
Invoke-Expression "$env:TEMP\report.html"


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>