Waclaw Chrabaszcz
... there is no spoon ...

PowerShell – How to display multicolor messages

Tuesday, June 2, 2015 8:59 AM

A quick post … I'm very busy. I'm scripting right now and I would like to display "green and red messages" to let my colleagues easy interpret script outputs. Take a look on this simple trick:

$server = "server1"
Write-Host "Testing $server connection ... " -NoNewline
if (Test-Connection $server -Quiet) {Write-Host "OK" -ForegroundColor Green }
else {Write-Host "Failed" -ForegroundColor Red }

All magic is hidden behind –noNewLine parameter

Cheers!




Feedback

# re: PowerShell – How to display multicolor messages

Great site Great people Great hacks FIFA 17 Ultimate team hack 11/8/2016 7:33 AM | heybuddy

# re: PowerShell – How to display multicolor messages

Gratuit Coins et Points For FIFA 17 Astuce FIFA 17 11/8/2016 7:34 AM | Rajneesh haramkhor

# re: PowerShell – How to display multicolor messages

If you want free coins and points FIFA 17 Coin generator is the thing you want 11/8/2016 7:35 AM | satargachi

# re: PowerShell – How to display multicolor messages

Get Free Gems and Gold From our official Clash royale Hack 11/8/2016 7:46 AM | kratos

# re: PowerShell – How to display multicolor messages

Free Tokens and Credits for you here Asphalt Xtreme Hack Cheats
11/8/2016 7:49 AM | Asphalt

# re: PowerShell – How to display multicolor messages

Get Free Gems for the game dawn of titans from our Dawn of titans cheats 11/8/2016 7:51 AM | Dawn of titans

# re: PowerShell – How to display multicolor messages

Get ultimate free gems in injustice 2 with injustice 2 free gems | and in mobile legends you can easily use Mobile legends cheats 6/1/2017 8:32 PM | hellomate

Post a comment