I have a function to write an output log to file and to console. The Write-Host part I'd like to color up a bit ;-)
switch($logLevel)
{
"FATAL" { $ConsoleWriteColor = "blue"; break }
"ERROR" { $ConsoleWriteColor = "red"; break }
"WARN" { $ConsoleWriteColor = "yellow"; break }
default { $ConsoleWriteColor = "white"; break }
}
Write-Host -ForegroundColor $ConsoleWriteColor "Hello world"
So my question is for the default case: How can I get the current foreground color? I guess it will not always be white?!