Well this VPN that I want to click auto connect is based on another app from Microsoft called Azure VPN Client. So I’m not sure if it’s still using the traditional way like the other VPNs, but I did find this:
I found this article that says “Set your Azure VPN connections to “Connect Automatically” with PowerShell”
https://powers-hell.com/2020/11/28/set-your-azure-vpn-connections-to-connect-automatically-with-powershell/
But I’m a little lost on how the “Retry reconnect” is being accomplished using powershell and/or Intune? Can you just do with Powershell or Task scheduler or command line to tell it to reconnect if it lost connection?
Someone also commented on the app review section and got a response from Microsoft:
Works well - just needs some extra features
Seems to work well, especially after the last update. To deploy this as an Enterprise solution it needs a few extra features. I'm looking to be able to configure/manage it via
Intune/Config Mgr or PowerShell etc. I like that I can now import the profile from the command line and that I can add routes and DNS suffixes to the profile XML file. What I'm still looking
for is the ability to configure automatic connection programmatically and Network Location Awareness so it doesn't try to connect when a device is connected to the cooperate network.
Pete 3 years ago
=======Response from Microsoft Corporation======
Thank you for your feedback, we are glad that you like the product. You can deploy a store app using Intune and then import the profile using a command-line script. https://docs.microsoft.com/en-us/azure/vpn-gateway/openvpn-azure-ad-client#can-i-imprt-the-profile-from-a-command-line-prompt%20. . We are evaluating the Network Location Awareness
request. Please check https://azure.microsoft.com/en-us/blog/topics/announcements/ for any updates
The author from the article above also mentioned: "
The key to this solution is found in the registry (as always). The auto connection settings can be found in the local machine hive path shown below.
HKLM:\SYSTEM\CurrentControlSet\Services\RasMan\Config"
But when I go there, I don’t see the setting AutoTriggerDisabledProfileList or any other from his screenshots, so it’s not clear if I’m supposed to add them manually or they’re supposed to appear there?
I also found this article about this registry setting:
https://msendpointmgr.com/2020/04/29/keeping-always-on-vpn-always-on/
But this has something to do with another program called Always On VPN?
Would appreciate if you have any suggestions or advice.
Just for reference, to disconnect from a VPN, it’s a simple one line command:
rasdial $vpnName /DISCONNECT;
And I already confirmed this works for the same vpn I was able to manually “automatically connect” or “connect”. Now, I’m looking for the equivalent command just for doing an auto-connect or connect to the vpn. I didn’t see under rasdial command options that it has anything to do with “/CONNECT” just “/DISCONNECT” and some other options.
TDLR: I’m looking for a XXXX command such as:
XXXXX $vpnName /AUTOCONNECT
or
XXXX $vpnName /CONNECT
Alternatively (if that’s easier), can I use powershell to open the specific settings window to open the second screenshot window (how do I do that?) and then simulate a mouse click in that area on the vpn and another one on the auto connect?
I think I saw here sometime someone mentioned there is a command that could open any navigation windows 11 settings page by using some sort of url like settings/vpn/etc how do I find what’s the settings url for the second screenshot so I could run a command to launch it with powershell?
Thank you.