Created
October 9, 2014 11:24
-
-
Save Ranger-X/a793e20843008db65921 to your computer and use it in GitHub Desktop.
ping.ps1
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
$ip = "10.20.30.40" | |
$result = gwmi -query "SELECT * FROM Win32_PingStatus WHERE Address = '$ip'" | |
if ($result.StatusCode -eq 0) { | |
Write-Host "$ip is up." | |
} | |
else{ | |
Write-Host "$ip is down." | |
Write-Host "Disconnecting..." | |
rasdial.exe DegreeVPN /DISCONNECT | |
Write-Host "Connecting..." | |
rasdial.exe DegreeVPN vpnUsername vpnPassword12345 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment