Link to home
Start Free TrialLog in
Avatar of DavidBurchett
DavidBurchettFlag for New Zealand

asked on

Auto Start VPN when windows 10 starts

Hi,

I have a windows 10 Pro laptop that has a VPN connection to a remote 2008R2 server. The VPN works fine but rather than manually start the connection each time I boot my Laptop I would like it to auto start.

I've tried using Windows Task Scheduler and rasdial as described in this article but it's failing to start the connection.

It may be that the article is for Windows 7 and I'm using Windows 10 but I'm not sure, any help appreciated.

Thanks
Avatar of McKnife
McKnife
Flag of Germany image

We don't know how you start the connection - do you just double click an icon (=shortcut)? If so, put that shortcut into the autostart folder. Find autostart like this:
-press winkey together with r [a run box appears]
-now enter shell:startup [and press enter :)]
A folder will appear, put it inside.
Avatar of DavidBurchett

ASKER

Hi McKnife,

I did look at that option but the connection is not a shortcut in Windows 10 but a menu (of sorts) on the VPN section of the Network & Internet page within the Windows 10 settings section.

Cheers
David
Ok, is that menu listed if you go to
winkey+r
ncpa.cpL
?
If so, can you rightclick-drag it from there to that startup folder I mentioned?
Yep it was the same menu so I added the shortcut to the startup folder and rebooted but it only loads the "Network & Internet" page with the VPN option highlighted ready to click the "Connect" button. We're halfway there I guess but I really need it to auto connect without having to click any buttons.
For me it works the following way:
task scheduler action: rasdial "vpn connection"
"run only when the user is logged on"
"run with highest privileges" NOT checked
I made changes:

task scheduler action: rasdial "vpn connection" - My connection name has no spaces so not using quotes I had my VPN username and password in the arguments field so I removed them leaving just the VPN name.
I had "Run whether user is logged on or not" so I changed it to "run only when the user is logged on"
I had "run with highest privileges" checked so I unchecked it.

If I click the "Run" button for this "Selected Item" it does run the task and the VPN connects. The DOS window opens and I can see the authentication and connection happen in real time. I had to add my username and password back in to the rasdial argument to get it to work using the "Run" button

If I restart or shut down and cold boot the laptop then task manager will not run this task.
ASKER CERTIFIED SOLUTION
Avatar of McKnife
McKnife
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
My Trigger is "At System Startup" should I change it?
You should.
That fixed it!

I used "At System Startup" as my original trigger as I wanted the VPN to pre connect by the time my login script had finished but the delay using "At login" is unnoticable so I'm a happy camper :-)

Worth noting the VPN username and password does have to be present.

Many thanks
You're welcome.
Legendary. Thanks Guys.  I have a (very) remote office too and just had to ship a new PC there after a lightning strike.  Didn't have time to ship the PC to me first for Domain setup as I previously have, so this one has to run with a local login.
I used scheduler to activate the VPN connection at logon using the instructions above which happens really quickly.
My only uncertainty was in the arguments box as my VPN has a worst practice name (with spaces), but my first effort worked with:
run program : C:\Windows\System32\rasdial.exe
Arguments: "MyDumbass VPN Connection Name" username Pa55word

I then scheduled another task at logon with the "delay for 15 seconds" option which runs a local copy of the domain-users start-up script to mount all the remote drives the user needs.  Runs like a dream.

Thanks for the pointer.