Last active
July 13, 2017 07:50
-
-
Save vpetruchok/14f26ce8a6acbbbf299564cede03a246 to your computer and use it in GitHub Desktop.
Ping wrappers
This file contains hidden or 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
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