Cheesy Christmas Tree Script V2

BSonPosh made me smile this morning with this fun little script http://bsonposh.com/archives/1076… One issue… I like a BIG tree, so I refactored Brandon’s code, Enjoy.

$Rows = 15
$colors = "DarkRed","Cyan","Red","Magenta","Yellow","White","cyan"            

while($true)
{
    $oldpos = $host.ui.RawUI.CursorPosition
    Foreach ($r in ($rows..1)){
        write-host $(" " * $r) -NoNewline
        1..((($rows -$r) * 2)+1) | %{
            if (($_%2) -eq 0) {
                write-Host "*" -ForegroundColor Darkgreen  -nonewline
            } else {
                write-Host "*" -ForegroundColor  ($colors | get-random) -nonewline
            }
       }
        write-host ""
    }            

    # trunk
    write-host $("{0}***" -f (' ' * ($Rows -1) ))  -ForegroundColor DarkGreen
    write-host $("{0}***" -f (' ' * ($Rows -1) ))  -ForegroundColor DarkGreen
    $host.ui.RawUI.CursorPosition = $oldpos
    sleep .05
}

‘Tis the season,

~Glenn