I need to make a VPN connection using pbk file and login / password silently without any dialogs. Just like run script - connected. Also user should not create a connection manually, everything should be done programmatically.
First I created a connection manually to check that it's working, I run pbk file, entered login and password in the new connection dialog and clicked connect button. The connection has been successfully created and VPN worked.
Then I closed the connection and run following command in the cmd:
rasdial "MyVPNName" "login" "password" /phonebook:"path\to\file.pbk"
and successfully connected to VPN. I was happy, everything works as I expected. But when I run the same command on another PC, I got 703 error:
The connection needs information from you, but the application does not allow user interaction.
I think it requires login and password. I noted that it ignores login and password in the command line and works with wrong credentials or even without them. I tried to create connection with rasphone.exe, but create connection dialog appears. When I created a connection with that dialog - rasdial command working even without login and password in the command line. It seems the system stores a connection and uses saved credentials to connect.
But it's not what I need. I need to establish a VPN connection in a single click in my application. In that app I'm planning to run rasdial.exe or another built-in utility and user should not see any another dialogs except my app or type login / password manually.
I have PreviewUserPw=0 in the pbk file as mentioned here Single-Click to connet to VPN on Windows 10 but it does not help, the dialog appears anyway.
Or maybe I could set login and password into pbk file? It it possible?