Batch file to open a VPN connection

Posted on 2009-02-18
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
    LVL 9

    Expert Comment

    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

    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?
    LVL 9

    Expert Comment

    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.
    LVL 9

    Expert Comment

    and rasdial will only work with dial-up/PPPoE connection i guess
    LVL 9

    Expert Comment

    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

    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

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
    Stuck in voice control mode on your Amazon Firestick?  Here is how to turn it off!!!
    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.
    Articles on a wide range of technology and professional topics are available on Experts Exchange. These resources are written by members, for members, and can be written about any topic you feel passionate about. Learn how to best write an article t…

    728 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now