Much prettier I think.īut wait - didn't I just say the VPN client isn't kind enough to trigger an event log when it disconnects? True - but what the disconnect does trigger almost immediately is a Browser election when the interface drops. Then you just set the scheduled action to run the damn thing again which, if it's set to connect on startup, reconnects the VPN. Something I found more elegant is a task schedule that triggers when the VPN disconnects. This is about as pretty as a looping ping command continuously in the background parsing the output for timeouts.ugh!
#Pia vpn windows 10 startup 2017 install#
The VPN client isn't kind enough to trigger an event log when it disconnects, so I started with the idea of monitoring the TAP NIC created by the PIA Client on install - but let me save you the time and tell you, don't waste your time with the WMIObjects - yes it does work, but it's a lot of work and you have to keep polling the status to see if it's up or down.
#Pia vpn windows 10 startup 2017 windows 7#
The laptop is a dedicated VPN machine I intend to use as a VPN Gateway, so I'm happy to leave it on Windows 7 for now. If you want THAT solution there are plenty of google articles out there. I'm running the VPN client on a Windows 7 laptop so I don't have access to the NetAdapter module (boohoo).
I have to admit, I spent quite a bit of time messing about with PowerShell and WMIObject to try and catch the NetEnabled trigger. You would think they would have an 'automatic reconnect' option or something but unfortunately not - so I created one. I'm not THAT paranoid about online connectivity, I just want a UK breakout - so basically just reconnect and carry on would be nice. The VPN client comes with a KillSwitch which automatically kills all network connections as soon as this happens - but it's not really what I'm after.