Windows VPN store PSK - Powershell script does not work. Still the best option ?
Hello Jeff
Great news, thanks. Do you know when we will see a verison of RDM with Windows VPN support included which isn't in beta ?
Regards
Windows VPN store PSK - Powershell script does not work. Still the best option ?
Hello Jonathan
This is the best news I have had in a while, great!
When do you expect to release version 2021.1.1.0 ?
Regards
Windows VPN store PSK - Powershell script does not work. Still the best option ?
Hi James
Thanks for your help and support.
I hope that your colleagues has an idea on this.
Best regards
Joe
Windows VPN store PSK - Powershell script does not work. Still the best option ?
Since it seems I cannot get the scripts to execute when calling them as Macro/Script/Tool in the VPN Before Open-events entry I created them as scripts on my PC and placed them on my C: drive in order to simply execute them from there.
It doesn't work though. When Opening the VPN, RDM is reporting that there's no program to execute the script, which seems weird since I have tied PS1 files to Powershell in Windows, also the scripts launch in Powershell just fine when double-clicking them directly.
Do you know why this happens ?
Best regards



Windows VPN store PSK - Powershell script does not work. Still the best option ?
It indeed worked to add the PS script directly to the entry. Just wanted to develop it further by embedding the scripts. Sadly the script does not execute this way for some reason...
Are there any logs I can search through, in order to see why RDM fails to execute the script? As stated it executes my "hello world" script just fine. But not the VPN-script.
Windows VPN store PSK - Powershell script does not work. Still the best option ?
Damn.. Sorry to hear that. Looks like I'm a bit on my own on this part then.
I really hope the you'll implement the Windows VPN in RDM better to save the PSKs etc. it would make it much easier for us and probably a lot of others too.
Are there any logs I can search through in order to find out why RDM isn't executing the script but just showing the PS-window imbedded ?
There must be something keeping it from executing it. If I can find a hint somewhere I might be able to figure out why.
Best regards
Joe
Windows VPN store PSK - Powershell script does not work. Still the best option ?
Update:
Just tried to create a hello world script (green type) and link it to the before-open-entry in the VPN, this script works just fine (only writes hello world to the host).
Must be something in the VPN-adapter script itself that prevents RDM from executing it maybe ?
Windows VPN store PSK - Powershell script does not work. Still the best option ?
Hello James
I would rather keep it in a single script instead of doing batch replace. This way we have only this script to maintain, and we won't have to replace it everywhere.
I just tried to create it as the blue entry (the one called test), however I can't seem to find this one to choose at the VPN-entry ?


Best regards
Joe
Windows VPN store PSK - Powershell script does not work. Still the best option ?
Hi again James
I tried to develop a little further on my implementation on this. Hope you have an idea.
As you know the PS-script is currently running in the VPN-entry under the "Before open"-event which works just fine.
I created a Macros/Scripts/Tools-entry in a folder in RDM named Scripts - This entry is configured as "embedded script" and I pasted the PS-script from earlier on.
In order to not have to copy the script into all of our Windows VPN-entries, I tried changing the "Before open"-event under the VPN-entry from script to Macro/Script/Tool and pointed it at the newly created Macros/Scripts/Tools-entry containing the PS-script to establish the VPN tunnel.
When launching the VPN-entry I now see a powershell-tab open in RDM, but I don't see it execute anything or doing anything. I wonder if it can't execute the script the way I'm utilizing it, or if it's just me missing something here ?
I've attached screenshots for you to see.
Thanks



Windows VPN store PSK - Powershell script does not work. Still the best option ?
Thank you. I am glad to always receive good help from you guys at this forum.
Merry Christmas
Best regards
Joe
Windows VPN store PSK - Powershell script does not work. Still the best option ?
Tried to use the following at the "After close"-event to automatically delete the VPN after ended session. It doesn't delete the VPN. Do you have an idea on that too?
Remove-VpnConnection -Name $RDM.Connection.VPN.Name; -Force
Edit: Deleted the semicolon after the variable name, works now.
Windows VPN store PSK - Powershell script does not work. Still the best option ?
Sorry. Works now. Forgot to change the phonebook back to "embedded" after playing with using our existing document.
Windows VPN store PSK - Powershell script does not work. Still the best option ?
It is running as admin, still doesn't work.
It opens just fine on your existing Windows VPNs, but those are configured on the parent folder of the entries where we would utilize the VPN. I can't find a option there to add the "Before Open"-Event.
This new VPN entry I'm currently playing with is added under the parent folder as a VPN entry, because I see that I can add the "Before Open"-Event here just as Jeff D's guide on the topic indicates. As stated, the script creates the VPN but it's not launched.
I would prefer to be able to add the "Before Open"-Event on the parent folder, but it doesn't seem like an option to me.
Windows VPN store PSK - Powershell script does not work. Still the best option ?
Hello James
Just replaced the script with the new one. This time the VPN is indeed created if not present.
When opening the VPN-session from RDM it doesn't launch the VPN, either after creating it nor concluded it's already there.
Do I have to enter additional information anywhere in order for it to actually start the VPN ?
My exact configuration looks like my screenshots posted earlier. The only change is your updated PS script.
Best regards
Joe
Windows VPN store PSK - Powershell script does not work. Still the best option ?
Hi James
Looking forward to hear how it goes with the testing in your end. If you need a Windows VPN to connect to, I can supply you credentials to one in our test-environment.
I just tried to add the following "Before Open"-event to the VPN-entry in RDM: "Add-VpnConnection -RememberCredential -Name test -ServerAddress 1.2.3.4 -TunnelType L2tp -L2tpPsk wegaweg -AuthenticationMethod Pap -Force -ErrorAction SilentlyContinue;" This does successfully create the VPN-adapter on my PC.
The problem is definitely that when running the supplied script in the "Before open"-event it detects the adapter the wrong way, thinking it is already created on the PC even though it's not, and that leads it to not creating the adapter at all.
Best regards
Joe
Windows VPN store PSK - Powershell script does not work. Still the best option ?
Hello James
Just tried to use a phonebook document instead, this fails in the same way...
Anyway I would like to stick to Windows default phonebook as we sometimes has problems closing the Windows VPN from RDM because RDM can't access the phonebook document as it is residing on a network drive which isn't always reachable because our Windows VPNs does not support split-tunneling hence no connection to the drive when on VPN session through RDM.
Windows VPN store PSK - Powershell script does not work. Still the best option ?
Hello
For a long time we've been using an embedded phonebook document to store details about our customers Windows VPN connections. This works mostly well, however it is a pain in the *** that we have to specify the PSK manually every time we connect from a new PC.
I found this topic, explaining how a Powershell script can be used to create the tunnels ad hoc and embed the PSK automatically, that would be a long step ahead from where this implementation is now. https://forum.devolutions.net/topics/33404/store-microsoft-vpn-configuration-profile-in-rdm
My current problem is that as soon as launching the VPN it (the PS script) states that the VPN-connection already exists which it doesn't. I don't know if the script reads the "$RDM.Connection.VPN.Name" wrong or what happens. If I run the script manually outside RDM I can create a VPN with the same name just fine...
I am trying to use the "Default Phonebook" (in Windows) to not have a centrally stored phonebook document, we have had this in the past, but it hasn't been very reliable.
I have attached screenshots of my configuration.
I'm using RDM V.2020.3.18.0
It might be that there is a better way of creating a Windows VPN and storing the PSK with it automatically, if so, please let me know.




OpenVPN: Allow multiple active profiles
Okay, thanks for your reply. Looking forward to see it implemented sometime.
Best regards
Joe
OpenVPN: Allow multiple active profiles
Hello David
Any news on this one. My team and I are really looking forward to the "OpenVPN multiple sessions"-option.
Best regards
Joe
Problems with OpenVPN Automatic authentication. Only some parts of username/password is entered
Aah okay, thanks for the clarification.
Problems with OpenVPN Automatic authentication. Only some parts of username/password is entered
Hello Carl
What can I achieve by using this new option ?
Regards
Joe
Problems with OpenVPN Automatic authentication. Only some parts of username/password is entered
Thanks for the link and your update.
Looking forward to see this implemented.
It is usable as it is now, which is great.
Thanks for your time and help!
Regards
Problems with OpenVPN Automatic authentication. Only some parts of username/password is entered
Hello David
Works now, fantastic!
The only problem now is that it does not always close the VPN connection after a session is closed, even though it is configured. Some times it does, and sometimes it doesn't. Currently running RDM without admin rights.
When running RDM as admin it does always close the VPN connection as supposed. I guess this works by killing the OpenVPN Interactive Service as it has actually rights to do that as admin.
When launching my OpenVPN GUI outside RDM (after having closed a VPN in RDM as admin) I get the error message that: "OpenVPNServiceInteractive" is not started. Which is of course because RDM killed the process when closing the tunnel. I think it would be a good idea if you implement it so that when closing a VPN in RDM it either closes it without killing the OpenVPN Interactive Service, or at least is restarting the service after the VPN is closed so that I won't have problems when opening the OpenVPN GUI afterwards.
It would be nice if RDM could reliably close the VPN every time without needing admin rights, but I don't know if that's possible ?
Thanks
Regards
Problems with OpenVPN Automatic authentication. Only some parts of username/password is entered
Just tried upgrading my client to 2.4.6 (2.4.6 x86_64-w64-mingw32).
Still having the same problem as above.
I can see that RDM creates the pwd file, but the log still terminates with: AUTH: Received control message: AUTH_FAILED.
Tried to make a copy of the pwd file that rdm creates, before it got deleted. When starting the VPN from the OpenVPN GUI using the copied file, I see the errors above. When I edit the pwd file to contain the password in clear text it works right away.
I wonder if I have to include anything in my .ovpn file to handle the password in your encrypted format, or if I should enable anything at the OpenVPN-server to allow this ?
Problems with OpenVPN Automatic authentication. Only some parts of username/password is entered
I guess that after it fails at the first try - probably because of the wrong/scrambled password in the .pwd file, it tries again and at this moment RDM deleted the .pwd file, leading to the "Error opening 'Auth' auth file: vpn.my-domain.dk.pwd: No such file or directory (errno=2)"