It's not stored in a registry key, it's stored in the RAS phone book.
The good news is, it's in a human-readable/editable file.
Head to C:\Users\<UserName>\Application Data\Microsoft\Network\Connections\Pbk
, and edit the rasphone.pbk
in a text editor (like say, Notepad).
Find the section that's header matches the name of the VPN contention you'd like to modify, and then change IpPrioritizeRemote=1
to IpPrioritizeRemote=0
to disable using the remote gateway.
To actually edit it via a script, PowerShell is probably easiest.
To get you going, here's a PowerShell (v2+) command that will update all VPNs in the PBK to NOT use the remote gateway, and then re-save the file (run it from the folder that contains the PBK file you want to update, or add absolute paths).
(Get-Content .\rasphone.pbk) -replace 'IpPrioritizeRemote=1', 'IpPrioritizeRemote=0' | Set-Content .\rasphone.pbk
1
Thanks, that's helpful, but I think this Powershell Cmdlet is only available for Win 8 and Windows 2012 or later, link
– Peter – 2016-02-02T20:46:26.510