Batch file to open a VPN connection

Posted on 2009-02-18
Medium Priority
Last Modified: 2013-11-10
Would anyone be able to provide the code needed to write a batch file that opens an existing VPN connection?

Many thanks

Question by:digital-doctors
  • 4
  • 2

Expert Comment

ID: 23681890
Depends wich vpn client are you using.
I use VPN Cisco Client and works only with a click ( open and connect)
You could put that shortcut in start up also and will connect in windows startup.

Author Comment

ID: 23682125
I'm using the standard Windows VPN client which I don't think will fully connect by simply adding it to the startup, it may open the connection window but that's all. My purpose for trying to do this is to automate the copying of an archive from the client PC to a server in remote location. If I can schedule a batch file to open the VPN I can then schedule and batch file to copy and send the archive file. I've found the following script command:
rasdial vpn_connection_name username password

but when I've tried it, it returns a 623 error "The system could not find the phonebook entry for this connection"

Any other thoughts?

Expert Comment

ID: 23682182
Do you will intereact with pc in that process?
I know that could not be the right choice but you can use a record macro....with all clicks and mouse movements.
Not a clean solution but most time do the job well done.
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.


Expert Comment

ID: 23682207
and rasdial will only work with dial-up/PPPoE connection i guess

Expert Comment

ID: 23682268
ups my mistake...will work with vpn too.

Error 623

The system could not find the phone book entry for this connection.

To work around this issue:

   1. Click Start, click Control Panel, and then click Network and Internet Connections.
   2. Click Network Connections.
   3. Right-click the VPN connection, and then click Properties.
   4. Click to select the Dial another connection first check box, and then click the appropriate dial-up connection. If there are no dial-up connections to select, you may have to create a dial-up connection and repeat these steps.

      If your VPN connection does not require a dial-up connection, click to clear the Dial another connection first check box, and then click OK.

Accepted Solution

digital-doctors earned 0 total points
ID: 23682412
I've already been through the steps you've just offered, there was no tick in the "Dial another connection" setting but the issue still persists. The macro option sounds possible though I would like to exhaust all options with the batch first.

Thanks for the input

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As computers become more powerful, jobs will be replaced with artificial intelligence, leaving no place in the future for humans in the workforce. In the oncoming technological revolution, the staggering change to human mind labor will prove the ski…
In this article, I’ll show how research, determination, and use of modern technology helped me solve a DNA mystery.
Notifications on Experts Exchange help you keep track of your activity and updates in one place. Watch this video to learn how to use them on the site to quickly access the content that matters to you.
Saved searches can save you time by quickly referencing commonly searched terms on any topic. Whether you are looking for questions you can answer or hoping to learn about a specific issue, a saved search can help you get the most out of your time o…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question