One of the things I dislike about Windows Vista is how many clicks it takes to connect to a VPN, and how I must wait for the connection to be completely established just to dismiss window when it is successful. I do most of my work remotely and connecting and disconnecting to and from a VPN is a part of my daily routine. I finally broke down today and found a faster way to connect and disconnect to and from a VPN.
Using the Command Line
First things first: you can connect to any of your VPNs using the rasdial command from the command line.
Here's the format to connect:
rasdial entryname [username [password|*]] [/DOMAIN:domain] [/PHONE:phonenumber] [/CALLBACK:callbacknumber] [/PHONEBOOK:phonebookfile] [/PREFIXSUFFIX]
And here's the format to disconnect:
rasdial [entryname] /DISCONNECT
For example, if your VPN is named "My VPN", your username is "johndoe" and your password is "password123", you could connect to the VPN from the command line like this:
rasdial "My VPN" johndoe password123
When you're finished, you can disconnect like this:
rasdial "My VPN" /DISCONNECT
Using Shortcuts
Once you've successfully connected and disconnected from the command line, it's a piece of cake to create a new windows shortcut that you can execute at will anytime you need to connect or disconnect. Just choose a folder were you want to shortcut to live, right-click, click New, click Shortcut, and in the dialog that comes up simply paste your tested command line text into the box that is labeled "Type in the location of the item," like so:
Click Next, then give this shortcut a name, like "My VPN Connect":
Click Finish, and you're done. Now you have a dedicated shortcut for connecting to your VPN:
Follow the same procedure to create a corresponding "My VPN Disconnect."
Using a Launcher
I keep all of my VPN Connect/Disconnect shortcuts in a single folder that I've cataloged with my launcher (Launchy). Now all I have to do to connect or disconnect from a VPN is hit my launcher hot key, type a few letters of the shortcut and hit enter when I get what I'm after:
No more hunting through the Windows Vista "Connect to a Network" list to find my VPN and then waiting for it to connect just so I can close the window that tells me it worked. Now I can connect or disconnect in just a few keystrokes.
More Tips...
If you find information like this helpful, I highly recommend Neal Ford's new book, The Productive Programmer. He spends an entire chapter covering useful applications and tricks that you can use to accelerate your work.