Where can I find/store L2TP presharedkey for a Pbk vpn (windows 10)
Solution 1
I Havent found an answer so far. starting the pbk creates an adapter but you can't really seem to change anything.
The alternative solution i found was using Powershell for this: https://technet.microsoft.com/en-us/library/jj554824(v=wps.630).aspx
Here you seem to be able to specify everything.
I Guess the program routine will be:
- Check if vpn with same name installed: delete it
- Create new vpn
- Start vpn, wait until done
- Delete vpn.
Powershell command will be like:
Add-VpnConnection test -L2tpPsk <PreSharedKeyHere>
Solution 2
The PSK is essentially Encoded and saved as a Password associated to the RasCredential Structure. The only other way to retrieve it would be by calling RasGetCredentials https://msdn.microsoft.com/en-us/library/windows/desktop/aa377512(v=vs.85).aspx
Another way to operate on L2TP and in general all Windows 10 VPN functionality is via the Configuration Service Provided For MDM's. Details for the VPNv2 CSP are at https://docs.microsoft.com/en-us/windows/client-management/mdm/vpnv2-csp this includes all the possible fields for a VPN Profile that you can Get or set. Additionally you can also use WMI to access these properties. For more details on that look at https://blogs.technet.microsoft.com/tip_of_the_day/2016/10/07/tip-of-the-day-configure-vpn-profiles-using-the-sccmwmi-bridge-part-2/ as well as https://docs.microsoft.com/en-us/windows/client-management/mdm/using-powershell-scripting-with-the-wmi-bridge-provider
Related videos on Youtube
Joel Harkes
Software Developer at NS Go. We provide solutions to manage mobility and policies within big corporations. Codewars:
Updated on September 18, 2022Comments
-
Joel Harkes over 1 year
I made a tool i can insert/start windows VPNS, i found vpns are stored in:
AppData\Roaming\Microsoft\Network\Connections\Pbk\phonebook.bak
This tool works great, amazing even. but now i found that it doensn't save the L2TP preshared key in this phonebook.
The key can normally found in adapter settings:
Is there any place in windows where i can find this stored key? and would there be a way to use a command to save/add this key to windows before i make the connection?
-
user541686 over 3 yearsThat function returns asterisks.