richardhicks / aovpn

PowerShell scripts and sample ProfileXML files for configuring Windows 10 Always On VPN
MIT License
158 stars 83 forks source link

AOVPN Profile XML Creation (Device Tunnel) #2

Closed ryanabach closed 4 years ago

ryanabach commented 4 years ago

I tried running your script against an AOVPN connection (device tunnel- IKEv2 authenticationl) setup on my Windows 10 machine... and its failing on line 75 "Cannot call a method on a null-valued expression"--- the code implies this is erroring on the creation of the XML file (my VPN connection is configured correctly). What is the correct syntax for this function?

richardhicks commented 4 years ago

I'll do some testing and try to reproduce this as soon as I can. Stay tuned!

richardhicks commented 4 years ago

Ok, I was able to reproduce the issue. This issue occurs when you attempt to extract ProfileXML from a device tunnel as a standard user. To extract ProfileXML from a device tunnel you must run the script in the context of the local system account. I've added some logic to detect if the script is running in the correct context and abort if it isn't correct. I've also update the comments to reflect this information.