tags:

views:

669

answers:

2

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 . Can anyone help me please ?

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 ) . If you could post some snippet that I could use , you win the bounty .

Thanks !

+1  A: 

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

Imran
+1  A: 

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
Will this have the same effect as with using the GUI ? Will the icon with the "computers" appear in the taskbar ?
Geo
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