Created
October 27, 2015 10:11
-
-
Save mjvh80/0c3124ba3fe3e36e4189 to your computer and use it in GitHub Desktop.
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
$job = $null; | |
function Start-MLVPN() { | |
$job = Start-Job -Name "Medialab VPN" -ScriptBlock { | |
for(;;) { | |
if (-not (Test-Connection -Quiet ssaquadev01.medialab.nl)) { | |
rasdial "Medialab VPN" /disconnect | |
rasdial "Medialab VPN" marcus XXXX; | |
} | |
sleep -Seconds 5; | |
} | |
} | |
} | |
function Stop-MLVPN() { | |
if ($job) { | |
Stop-Job $job; | |
} | |
rasdial "Medialab VPN" /disconnect | |
} | |
write-host "Starting background job for ML VPN..."; | |
Start-MLVPN |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment