Created
January 9, 2017 02:23
-
-
Save tombasche/d72cf0c4c08d0460b4fccad3725bee3e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param ( | |
[Parameter(Mandatory=$true)][string]$Hostname | |
) | |
$failure = "" | |
while (!$failure) { | |
try { | |
$net = [System.Net.Dns]::GetHostAddresses($Hostname) | |
$Host.UI.RawUI.BackgroundColor = ($bckgrnd = 'DarkGreen') | |
} catch [Exception] { | |
$failure = "yes" | |
$Host.UI.RawUI.BackgroundColor = ($bckgrnd = 'Red') | |
return $_.Exception.Message | |
} | |
$ping = new-object system.net.networkinformation.ping | |
$ping.send($Hostname) | |
Start-Sleep -s 1 | |
Clear-Host | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
NB. may need to run 'Set-ExecutionPolicy Unrestricted' in an admin window