Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to automate VPN connection to come ON nightly so that a database can replicate, then I would like to have it turned off. I know how to schedule Tasks, but is there a command line interface for the VPN connections? or how to turn this on/off?

share|improve this question

It's a little bit of a process, but yes it can be done.

Create a VPN connection, save the username and password. Save the username and password. Disable the requirement to display progrss while connecting. Disable the "Prompt for name and password, certificate, etc".

Create a shortcut to the network connection. Save it somewhere handy. Create a batch file which simply has the name of the .lnk file in it. If the .lnk file is called "corp_vpn.lnk" the file should look like:


Then have it mirror the data.

To disconnect automatically, set the idle timeout (probably set it nice and high) and it'll connect and disconnect as needed.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.