Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 224018

Re: Trouble Formatting Font Color in Report

$
0
0

Thanks for your help Matt....that worked. I passed the function to a variable after I got the number values then passed the values with the function to the html table:

 

#Format numerical data using the Get-FriendlyUnit Function before passsing string to HTML Table

$Cap = Get-FriendlyUnit -Value $Capacity | %{"{0,7:f2} {1,2}" -f $_.Value,$_.Unit}

$Prov = Get-FriendlyUnit -Value $Provisioned | %{"{0,7:f2} {1,2}" -f $_.Value,$_.Unit}

$Free = Get-FriendlyUnit -Value $FreeSpace | %{"{0,7:f2} {1,2}" -f $_.Value,$_.Unit}

$USpace = Get-FriendlyUnit -Value $Used | %{"{0,7:f2} {1,2}" -f $_.Value,$_.Unit}

 

$Cond1 = If ($Capacity -gt $Provisioned)
    {"<td><font face='Tahoma'>$Prov</font></td>"}
      ElseIf ($Capacity -lt $Provisioned)
    {"<td><font face='Tahoma'color = 'red'>$Prov</font></td>"}

$Cond2 = if ( ($PercFree -lt $Warning) -and ($PercFree -gt $Critical) )
    {"<td><font face='Tahoma'color = 'orange'>$PercFree</font></td></tr>"}
      ElseIf ($PercFree -lt $Critical)
    {"<td><font face='Tahoma'color = 'red'>$PercFree</font></td></tr>"}
      Else
    {"<td><font face='Tahoma'color 'black'>$PercFree</font></td></tr>"}

#Write output to html table
###########################
    $tableEntry = "<td><font face='Tahoma'>$Name</font></td>" +
        "<td><center><font face='Tahoma'>$Cap</font></center></td>" +
  $Cond1 +
        "<td><center><font face='Tahoma'>$Free</font></center></td>" +
  "<td><center><font face='Tahoma'>$USpace</font></center></td>" +       
         $Cond2
        Add-Content $fileName $tableEntry
        Write-Host $tableEntry
}



Viewing all articles
Browse latest Browse all 224018

Trending Articles



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