Solved

Connect to existing VPN connection using PowerShell

Posted on 2010-09-15
4
9,114 Views
Last Modified: 2012-08-13
I am doing some systems automation with powershell and have a situation where I need to connect to several different VPN connections based on the remote servers I need to work with.  

Since we can not (for security reasons) leave the VPN connections open, I just want to open the VPN session using PowerShell and when the processes are done, close the connection.

The VPN is a standard MS VPN connection on Windows 7 or Windows Server 2008 (& 2008 R2)
The VPN connections have already been configured, so I just simply need to connect.

I am hoping someone can steer me in the right direction on how to open and close connection.

Thanks!

0
Comment
Question by:TriadX1
  • 2
4 Comments
 
LVL 9

Expert Comment

by:Sander Stad
Comment Utility
Microsoft has written an article about this on technet. You can look it up in here: http://technet.microsoft.com/en-us/library/ee431700(WS.10).aspx

You don't have to create the scripts yourself because you can download them at: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=ce82bbd3-948b-476b-ab2e-1a1696349905&displaylang=en

0
 
LVL 1

Author Comment

by:TriadX1
Comment Utility
I am not trying to deploy a new VPN connection. I am trying to connect to an previously deployed connection via powershell.
0
 
LVL 68

Accepted Solution

by:
Qlemo earned 500 total points
Comment Utility
With the Command Prompt, you just use rasdial. You can do the same from PowerShell. RasDial allows for providing data via commandline, but you do not need to:

rasdial VPN1        will "dial", i.e. start the RAS connection entry named VPN1
rasdial VPN1 /d    will stop the VPN
0
 
LVL 1

Author Closing Comment

by:TriadX1
Comment Utility
Perfect!!!! Works just fine!
0

Featured Post

Promote certifications in your email signature

Has your company recently won an award or achieved a certification? They'll no doubt want to show it off. Email signature images used to promote certifications & awards can instantly establish credibility with a recipient and provide you with numerous benefits.

Join & Write a Comment

I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This tutorial will give a an overview on how to deploy remote agents in Backup Exec 2012 to new servers. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as connecting to a remote Back…
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now