Solved

Connect to existing VPN connection using PowerShell

Posted on 2010-09-15
4
11,205 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
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 69

Accepted Solution

by:
Qlemo earned 500 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

A brief introduction to what I consider to be the best editor for PowerShell.
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
This tutorial will walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…

685 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