Solved

Connect to existing VPN connection using PowerShell

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

This article explains how to install and use the NTBackup utility that comes with Windows Server.
The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

734 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