Tim Hibbard

CEO for EnGraph software
posts - 617, comments - 727, trackbacks - 467

My Links

News



Add to Google




Twitter












Tag Cloud

Article Categories

Archives

Post Categories

Image Galleries

EnGraph Blogs

Links

Other

Roll

Launching VPN at startup

If you need to connect to a Virtual Private Network at windows startup, and you don't want to have the user push connect or enter the password do the following:
1) On the VPN Connect screen, check "Save this user name and password for the following users"
2) Select the "Anyone who uses this computer" radio button
3) Click "Properties" on the VPN Connect screen
4) On the "Options" tab, uncheck:
-"Display progress while connecting"
-"Prompt for name and password, certificate,etc."
5) In Windows Explorer, browse to C:\Documents and Settings\All Users\Start Menu\Programs\Startup
6) Open a new Windows Explorer and browse to Control Panel\Network Connections
7) Drag the icon of your VPN connection to the Startup folder. This will create a shortcut

Now at Windows startup, the VPN will launch and connect silently.

Print | posted on Wednesday, April 27, 2005 3:30 PM |

Feedback

Gravatar

# re: Launching VPN at startup

I am thrilled !

Just the solution I was looking for!

Thank you!

Regards
Brian
4/7/2006 2:24 AM | Brian
Gravatar

# re: Launching VPN at startup

Fantastic - spent ages trying to do this with .bat files
11/28/2006 5:36 PM | peterz
Gravatar

# re: Launching VPN at startup

That will only launch the VPN when the user logs in, which is fine if there really is a user, but not if it's a server.
2/22/2007 8:45 AM | Ross Presser
Gravatar

# re: Launching VPN at startup

You are correct Ross. In the case of a server, you would want to create a windows service. I have written some code to maintain a VPN connection programatically, see the following link for more details:
http://geekswithblogs.net/thibbard/articles/CSharpCodeToMaintainVPNConnectionProgramatically.aspx
2/22/2007 9:04 AM | Tim Hibbard
Gravatar

# re: Launching VPN at startup

To start a VPN on system startup and keep checking it is running you can simply add rasdial to a windows schedule that is set to run at startup.
This is not as thourough as Tim's approach but is very easy to do. Your windows schedule can be set to start on system startup and can have multiple schedules incase the connection gets dropped.
Hope this helps!
rasdial "connection name"
3/23/2007 6:38 AM | AndyTripp
Gravatar

# re: Launching VPN at startup

By using your code we are trying to connect VPN without populating the VPN dialog box we are passing the username ,password(secure string) as shown below.
our purpose is to establish the VPN connection through coding .

Please help us in finding a solution.




private bool ConnectToVPN()
{
bool RV = false;
try
{
OnConnecting();


string TEXTDATA = "123456";
System.Security.SecureString secretString = new System.Security.SecureString();
foreach (char c in TEXTDATA)
secretString.AppendChar(c);


ProcessStartInfo myProcess = new ProcessStartInfo(VPNPROCESS);
myProcess.Arguments = VPNConnectionName;
myProcess.UserName = "aaaaaa";

myProcess.Password = secretString;
myProcess.Domain = "";

myProcess.UseShellExecute = false;
Process.Start(myProcess);


System.Windows.Forms.Application.DoEvents();
System.Threading.Thread.Sleep(5000);
System.Windows.Forms.Application.DoEvents();
RV = true;
OnIdle();

}
catch (Exception Ex)
{
Debug.Assert(false, Ex.ToString());
RV = false;
OnIdle();
}
return RV;
}
7/10/2007 6:26 AM | samyvel
Gravatar

# re: Launching VPN at startup

You can use the rasdial command. But your password will be wide open.

If you are using a server I strongly recommend a more professional approach; hardware or software vpn running at your gateway. Windows VPN dialup will give you all sorts of problems.
7/26/2007 10:22 PM | Loknar
Gravatar

# re: Launching VPN at startup

awesome, just a solution a'm looking for!
12/19/2008 9:04 AM | max
Gravatar

# re: Launching VPN at startup

Wow man, it's a really easy way. Thank you for very helpfull tip
5/21/2009 9:54 AM | vpn account
Gravatar

# re: Launching VPN at startup

if i use this vpn, will my data secured?
1/19/2010 10:32 PM | jefrey
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 

Powered by: