HTML/CSS Help with Powershell Scripts

Welcome Forums General PowerShell Q&A HTML/CSS Help with Powershell Scripts

This topic contains 1 reply, has 2 voices, and was last updated by

9 months, 2 weeks ago.

  • Author
  • #122654

    Topics: 2
    Replies: 0
    Points: 4
    Rank: Member

    So my code looks like this. My question is I'm trying to find a way to add color highlights to certain cells. So for example in the Test-MemoryUsage function the script will produce information about the server printing out the Total Size and the Percent Free. I would like to able to add a style where if the Percent free is less than a number then it will highlight more so red and if it is in good standing then it will highlight green.

    function Get-DataSheet{
        param (
                     $frag5 = Test-MemoryUsage | convertto-html -Fragment -PreContent '

    Memory Usage

    ' | Out-String $head = @' '@ convertto-html -head $head -PostContent $frag1,$frag2,$frag3,$frag4,$frag5,$frag6,$frag7,$frag8,$frag9 -PreContent '

    Data Collection Sheet

    ' | out-file C:\Data.html Invoke-Item "C:\Data.html" #Open the document. } End{} }
  • #122663

    Topics: 8
    Replies: 1191
    Points: 646
    Helping Hand
    Rank: Major Contributor

    When you start getting beyond basic HTML + CSS using ConvertTo-HTML, you'll need to do a loop and manually generate the html code adding style tags or another options is using some fun methods like this:

The topic ‘HTML/CSS Help with Powershell Scripts’ is closed to new replies.