function ColorConsole {param($FGColor,$BGColor,$message,[switch]$KeepNewColors) $console = (get-host).ui.rawui $originalForeground = $console.ForegroundColor $originalBackground = $console.BackgroundColor if ($FGColor) { $console.ForegroundColor = $FGColor } if ($BGColor) { $console.BackgroundColor = $BGColor } if ($message) { $message } if (!$KeepNewColors) { $console.ForegroundColor = $originalForeground $console.BackgroundColor = $originalBackground } }