I wanted to make a nice GUI for my little script. I've this post describing a function how to do it.
function Write-Color([String[]]$Text, [ConsoleColor[]]$Color) {
for ($i = 0; $i -lt $Text.Length; $i++) {
Write-Host $Text[$i] -Foreground $Color[$i] -NoNewLine
}
Write-Host
}
Write-Color -Text Red,White,Blue -Color Red,White,Blue
It generally works fine but it doesn't like when there are spaces. I wanted to make sure the output is good looking so I've added some spaces..
Write-Color -Text "`t`t`SQL Connectivity: ", "Verified ($gSerlServer\$gServerSqlDB)" -Color White, Green
Is there a way so that it would include the spaces and not act weirdly (at least from my point of view?). The funny thing is it sometimes display it correctly, and sometimes it doesn't. I don't have a clue why?