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:
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.
Network Connections control
In first run, edit My VPN Settings
After setup, edit My VPN Settings
Destination VPN host settings
Silent VPN up settings
VPN TCP advanced
Advanced network connection
Set priority interface
Set priority interface apply
Set priority network provider
Use powershell or WSH.
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.
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)