you can use rasdial (which is built into windows) and create a batch script (.bat extension) like this:
rasdial connectionname
-or-
if you want to do this in a programming language, you can just call the command inside
C # example:
public static int OpenConnection(string connectionName, int Timeout) {
int ExitCode;
ProcessStartInfo ProcessInfo;
Process Process;
ProcessInfo = new ProcessStartInfo("cmd.exe", "/C rasdial " + connectionName);
ProcessInfo.CreateNoWindow = true;
ProcessInfo.UseShellExecute = false;
Process = Process.Start(ProcessInfo);
Process.WaitForExit(Timeout);
ExitCode = Process.ExitCode;
Process.Close();
return ExitCode;
}
and I guess your desired language will have something like this.
oh and you can use:
rasdial "connection name" /d
to remove the connection.
source
share