3

I have a PPPOE connection on a computer. That computer has two LAN cards and I activated ICS on it. The problem is, the connection kinda degrades over time (don't know why), and a redial would be nice, hourly maybe. I was thinking of writing an AutoIT script that would do this, if, for example I'm sending some data to a port the gateway pc is listening on. The only trouble is, I don't know what's the name of the executable I would have to run.

EDIT: I'm interested in the one with the GUI.

EDIT 2: I am interested in automating this process, and wouldn't like to have to write the thing in AutoIT (this a last resort option).

Cœur
  • 37,241
  • 25
  • 195
  • 267
Geo
  • 93,257
  • 117
  • 344
  • 520

2 Answers2

3

you can use rasdial (which is build in into windows) and create a batch script (.bat extension) like so:

rasdial connectionname

-or-

if you want to do it in a programming language, you can just call the command internally

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 available as well.

oh and you can use:

rasdial "connection name" /d 

to drop the connection.

sven
  • 18,198
  • 10
  • 51
  • 62
  • Will this have the same effect as with using the GUI ? Will the icon with the "computers" appear in the taskbar ? – Geo Jan 27 '09 at 18:32
  • I cannot test this right now, but I believe that the "connected" icon will indeed be visible in the taskbar, just as the other "network icons" are visible. – sven Jan 27 '09 at 18:36
1

Maybe you can make something for yourself with rasdial and at?

Imran
  • 87,203
  • 23
  • 98
  • 131