Skip to content

Instantly share code, notes, and snippets.

@Ranger-X
Created October 9, 2014 11:24
Show Gist options
  • Save Ranger-X/a793e20843008db65921 to your computer and use it in GitHub Desktop.
Save Ranger-X/a793e20843008db65921 to your computer and use it in GitHub Desktop.
ping.ps1
$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