Skip to content

This repository contains the code used to build the Powershell helper module: VPNCredentialsHelper that can be used to set the username and password of a VPN connection without having to manually enter them through the prompt.

Notifications You must be signed in to change notification settings

paulstancer/VPNCredentialsHelper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

VPN Credentials Helper PowerShell Module

This repository contains the code used to build the PowerShell helper module: VPNCredentialsHelper.

The module can set a username and password directly for a named VPN connection, so that you are not prompted to enter it the first time you connect.

To install the module enter the following PowerShell command.

Install-Module -Name VPNCredentialsHelper

This will add the Set-VpnConnectionUsernamePassword as a PowerShell command.

And then you can script something like this:

$name = "ExpressVPN Australia Sydney"
$address = "aus1-ubuntu-l2tp.expressprovider.com"
$username = "your_username"
$plainpassword = "your_password"

Add-VpnConnection -Name $name -ServerAddress $address -TunnelType L2tp -EncryptionLevel Required -AuthenticationMethod MSChapv2 -L2tpPsk "12345678" -Force:$true -RememberCredential:$true -SplitTunneling:$false 

Set-VpnConnectionUsernamePassword -connectionname $name -username $username -password $plainpassword -domain ''

Security

Please note: you will have to set your policy to permit unsigned PowerShell scripts to execute, to run this command.

If you're nervous about doing this, the actual script source code can be found here.

Thanks

A huge thanks to Jeff Winn for the DotRas project (https://dotras.codeplex.com/) which showed me the way, and who did all the really hard work.


Paul Stancer

About

This repository contains the code used to build the Powershell helper module: VPNCredentialsHelper that can be used to set the username and password of a VPN connection without having to manually enter them through the prompt.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published