Some clients generate their VPN connection settings using the CMAK (Connection Manager Administration Kit). Apart from the cumbersome way to support both x86 and x64 at the same time, they usually add in some kind of time-out feature, and often route the whole 10.0.0.0/8 network over the VPN to just host a couple of dozen machines. Having done most of my VPN connections by hand, and automating them using rasdial to dial these from the commandline, I also found out the hard way that you cannot use rasdial for CMAK generated VPN connections: it will give you the error “This function is not supported on this system.”. The funny thing is: you can disconnect using rasdial. Luckily, the far less well documented rasphonedoes work for dialing. The batch file below uses a few tricks, and you can set the parameters in the top of the batch file.
- it uses :: as comment markers
- is uses the && and || conditional execution constructs to either continue on success or failure.
- all variables are local using setlocal/endlocal
- ping is used to wait a certain time