4

I would like my (W7 Pro) VPN to start up automatically when I connect to my work wifi, but not others. Is this possible? I still want to be able to connect manually when I'm elsewhere, but avoid getting my work emails coming at me unless I'm at work (i.e. on work wifi), or choose to have it.

I found Rasdial but need to know how to trigger it upon connection to a particular network.

James N
  • 143

2 Answers2

2

You can run a script to do this. Just put it in Startup folder, or run it manually, etc.

This Powershell script I wrote should do the trick. Just edit the IP for the gateway on your work WiFi and replace notepad with your rasdial command.

if (!(Test-Connection 192.168.20.1 -Quiet)){
Start-Sleep -s 10 
}

Else {
# replace the command below with your rasdial string
& 'C:\Windows\notepad.exe'
Exit
}
Keltari
  • 75,447
1

See the Answer for this question. You can run a "scheduled" task based on an event trigger. This could either start your VPN directly or via a script depending on the software in use.

Julian Knight
  • 14,749
  • 3
  • 31
  • 46