In an XP Pro workstation, is there a way to start the native Windows VPN client and open/close a connection from the command line so it can be scripted in a batch file?
In an XP Pro workstation, is there a way to start the native Windows VPN client and open/close a connection from the command line so it can be scripted in a batch file?
Yes, if the VPN connection is called "My VPN" then:
will dial the connection. Helpfully it sets errorlevel to the RAS error code if it fails to connect, so your script can detect a connection failure. If you need to supply a username and password instead of using the saved credentials use:
To disconnect a connection use:
JR
An alternative that works under Windows 7 (not sure about XP) is:
This brings up the "dialling" dialog, same as if you double-click on the connection. If you have the username and password saved it automatically dials.
rasdial
did not work for me (on Windows 7):If you add empty strings under Windows 7 it works with cached credentials: rasdial "My VPN" "" "" (those are two pairs of double quotes with nothing in between)
Run command-line:
Control ncpa.cpl
Network Connections control
In first run, edit My VPN Settings
After setup, edit My VPN Settings
Save credentials
Destination VPN host settings
Silent VPN up settings
VPN networking
VPN TCP advanced
VPN gateway
Advanced network connection
Set priority interface
Set priority interface apply
Set priority network provider
Script
Silent-dial.cmd
:Use powershell or WSH.
I have not seen a command line scheme for the client yet. But, that does not mean it cannot be automated in scripts. Here is a two step approach,
If I recollect correctly, the code for pressing enter on a window is simply,
Look at the Send command.
You can setup AutoIt on one of your administration machines, get the script working, make and executable for it, and give it to the users. It can then be launched from command line as an executable.