?
Solved

Connect to existing VPN connection using PowerShell

Posted on 2010-09-15
4
Medium Priority
?
12,757 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 9

Expert Comment

by:Sander Stad
ID: 33689310
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
ID: 33689341
I am not trying to deploy a new VPN connection. I am trying to connect to an previously deployed connection via powershell.
0
 
LVL 70

Accepted Solution

by:
Qlemo earned 2000 total points
ID: 33696338
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
1
 
LVL 1

Author Closing Comment

by:TriadX1
ID: 33698866
Perfect!!!! Works just fine!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
This tutorial will show how to push an installation of Backup Exec to an additional server in both 2012 and 2014 versions of the software. Click on the Backup Exec button in the upper left corner. From here, select Installation and Licensing, then I…
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
Suggested Courses

762 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