Hello,
-
It appears that the value comparisons (the "-lt" and "-gt") that you doing there are of the values after they have been formatted to "friendly" units and then made into strings. The comparison operations then do not give the results that you are expecting, as the comparisons are of these strings, instead of actual numbers. Illustration:
PS C:\> "600.00 MB" -lt "594.75 GB" False PS C:\> "600.00 MB" -gt "594.75 GB" True
Clearly not what you would expect if the comparisons were of numbers instead of strings.
So, you would do better to keep the size values as numbers until it is time to display them (or write the HTML). That way the comparison operations (of the numbers) will behave as desired/expected, and your conditional formatting should work. The key there is to do comparisons of actual numbers, then use the formatted string values of the numbers for the HTML output. Make sense?