Skip to content

Instantly share code, notes, and snippets.

@vpetruchok
Last active July 13, 2017 07:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vpetruchok/14f26ce8a6acbbbf299564cede03a246 to your computer and use it in GitHub Desktop.
Save vpetruchok/14f26ce8a6acbbbf299564cede03a246 to your computer and use it in GitHub Desktop.
Ping wrappers
function playNotificationSound() {
# From http://scriptolog.blogspot.com/2007/09/playing-sounds-in-powershell.html
$sound = New-Object System.Media.SoundPlayer;
$sound.SoundLocation="c:\WINDOWS\Media\notify.wav";
$sound.Play();
}
function p() {
Param(
$ComputerName="google.com"
)
ping.exe $ComputerName @args
}
function playNotificationSound() {
# From http://scriptolog.blogspot.com/2007/09/playing-sounds-in-powershell.html
$sound = New-Object System.Media.SoundPlayer;
$sound.SoundLocation="c:\WINDOWS\Media\notify.wav";
$sound.Play();
}
function p() {
Param(
$ComputerName="google.com"
)
ping.exe $ComputerName @args
}
function pp() {
$delay = 5
while($True) {
p @args
if ($LASTEXITCODE -eq 0) { break; }
Write-Host(" (Next attempt in {0} seconds...)" -f $delay)
sleep $delay
}
playNotificationSound
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment