Skip to content

Instantly share code, notes, and snippets.

@mjvh80
Created October 27, 2015 10:11
Show Gist options
  • Save mjvh80/0c3124ba3fe3e36e4189 to your computer and use it in GitHub Desktop.
Save mjvh80/0c3124ba3fe3e36e4189 to your computer and use it in GitHub Desktop.
$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