Script to install and automate the start/stop of wsl-vpnkit. #186
nlvw
started this conversation in
Show and tell
Replies: 1 comment
-
This only for Windows 11? I am not specialist of powerShell scripts, so can it be easily changed to working with Widows 10 as well? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Based on a few other posts I've seen here on powershell scripts and starting/stopping i've created an all in one solution.
https://gist.github.com/nlvw/5a563242651c0aaaeb078c860d70a0a5
The above gist contains a powershell script that will install/update wsl-vpnkit. It will also create a scheduled task, in windows, that will automatically start/stop wsl-vpnkit when Cisco Anyconnect connects/disconnects. The start/stop automation should be similar for other VPN providers you just need to track down what to trigger of off in the Windows event log.
So far this has worked great as the wsl-vpnkit only runs when I need it and I don't have to think about starting and stopping it. The other benefit is WSL will properly shutdown when not in use and the host VPN (Cisco Anyconnect) isn't connected. That leads to the drawback that WSL will always be running when the host VPN is connected even if the only WSL distro running is wsl-vpnkit itself.
Beta Was this translation helpful? Give feedback.
All reactions