PowerShell Logo Small

Add-VpnConnection



This is the built-in help made by Microsoft for the command 'Add-VpnConnection', in PowerShell version 4 - as retrieved from Windows version 'Microsoft Windows 8.1 Enterprise' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Adds a VPN connection to the Connection Manager phone book.

SYNTAX


Add-VpnConnection [[-RememberCredential]] [[-UseWinlogonCredential]] [[-EapConfigXmlStream] <XmlDocument>] [-Name] <String> [-ServerAddress] <String> [[-TunnelType] <
String>] [[-EncryptionLevel] <String>] [[-AuthenticationMethod] <String[]>] [[-SplitTunneling]] [[-AllUserConnection]] [[-L2tpPsk] <String>] [-AsJob] [-CimSession <Ci
mSession[]>] [-DnsSuffix <String>] [-Force] [-IdleDisconnectSeconds <UInt32>] [-MachineCertificateEKUFilter <String[]>] [-MachineCertificateIssuerFilter <X509Certific
ate2>] [-PassThru] [-ServerList <CimInstance[]>] [-ThrottleLimit <Int32>] [-Confirm] [-WhatIf] [<CommonParameters>]
Add-VpnConnection [[-RememberCredential]] [-PlugInApplicationID] <String> [-Name] <String> [-ServerAddress] <String> [[-SplitTunneling]] [-AsJob] [-CimSession <CimSes
sion[]>] [-DnsSuffix <String>] [-Force] [-IdleDisconnectSeconds <UInt32>] [-PassThru] [-ServerList <CimInstance[]>] [-ThrottleLimit <Int32>] -CustomConfiguration <Xml
Document> [-Confirm] [-WhatIf] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Add-VpnConnection cmdlet adds a VPN connection with the specified parameters to the Connection Manager phone book. If errors occur when you create the VPN profile
, the cmdlet returns the error information.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/?LinkID=290774
Get-VpnConnection
Set-VpnConnection
Remove-VpnConnection
New-EapConfiguration

REMARKS

<

Examples


Example 1: Add a VPN connection

PS C:\> Add-VpnConnection -Name "Test1" -ServerAddress "10.1.1.1" -PassThru
Name : Test1
ServerAddress : 10.1.1.1
AllUserConnection : False
Guid : {4B308E9B-C225-42CB-8158-307193429591}
TunnelType : Automatic
AuthenticationMethod : {MsChapv2}
EncryptionLevel : Required
L2tpIPsecAuth : Certificate
UseWinlogonCredential : False
EapConfigXmlStream :
ConnectionStatus : Disconnected
NapState : NotConnected
RememberCredential : False
SplitTunneling : False



This command adds a VPN connection named Test1 to the server with an IP address 10.1.1.1. By specifying the Passthru parameter, you can see the configuration of the V
PN connection object.




Example 2: Add a VPN connection with an alternate authentication method

PS C:\>Add-VpnConnection -Name "Test3" -ServerAddress "10.1.1.1" -TunnelType Pptp -EncryptionLevel Required -AuthenticationMethod MSChapv2 -UseWinlogonCredential -Spl
itTunneling -AllUserConnection -RememberCredential -PassThru
Name : Test3
ServerAddress : 10.1.1.1
AllUserConnection : True
Guid : {76746D4E-D72A-467D-A11F-3D4D9075F50D}
TunnelType : Pptp
AuthenticationMethod : {MsChapv2}
EncryptionLevel : Required
L2tpIPsecAuth :
UseWinlogonCredential : True
EapConfigXmlStream :
ConnectionStatus : Disconnected
NapState : NotConnected
RememberCredential : True
SplitTunneling : True



This command adds a VPN connection named Test3 to the server with an IP address 10.1.1.1. This connection uses the MSCHAPv2 authentication method, as specified by the
AuthenticationMethod parameter. Additional parameters specify that the connection:

-- Uses the Windows logon credentials (the UseWinlogonCredential parameter)
-- Uses split tunneling (the SplitTunneling parameter)
-- Is stored in the global phone book (the AllUserConnection parameter)
-- Caches the credentials used for the first successful connection (the RememberCredential parameter)

By specifying the Passthru parameter, you can see the configuration of the VPN connection object.




Example 3: Add a VPN connection that uses EAP authentication

PS C:\>Add-VpnConnection -Name "Test4" -ServerAddress "10.1.1.1" -TunnelType L2tp -EncryptionLevel Required -AuthenticationMethod Eap -SplitTunneling -AllUserConnecti
on -L2tpPsk "password" -Force -RememberCredential -PassThru
Name : Test4
ServerAddress : 10.1.1.1
AllUserConnection : True
Guid : {1D423FF3-E3D4-404A-B052-DB9130656D29}
TunnelType : L2tp
AuthenticationMethod : {Eap}
EncryptionLevel : Required
L2tpIPsecAuth : Psk
UseWinlogonCredential : False
EapConfigXmlStream : #document
ConnectionStatus : Disconnected
NapState : NotConnected
RememberCredential : True
SplitTunneling : True



This command adds a VPN connection named Test4 to the server with an IP address of 10.1.1.1. This connection uses the default EAP authentication method, as specified
by the AuthenticationMethod parameter. The pre-shared key for the connection is specified by the L2tpPsk parameter Additional parameters specify that the connection:

-- Uses split tunneling (the SplitTunneling parameter)
-- Is stored in the global phone book (the AllUserConnection parameter)
-- Caches the credentials used for the first successful connection (the RememberCredential parameter)

By specifying the Passthru parameter, you can see the configuration of the VPN connection object.




Example 4: Add a VPN connection that uses a custom EAP authentication method

This command stores the result of the New-EapConfiguration cmdlet into the variable named $A.
PS C:\>$A = New-EapConfiguration


This command adds a new VPN connection named Test5 to the server with an IP address of 10.1.1.1. This connection is configured to use the custom EAP authentication me
thod specifying the EapConfigXmlStream parameter, and using the EapConfigXmlStream method of the $A variable created earlier. Additional parameters specify that the c
onnection:

-- Uses split tunneling (the SplitTunneling parameter)
-- Is stored in the global phone book (the AllUserConnection parameter)
-- Caches the credentials used for the first successful connection (the RememberCredential parameter)By specifying the Passthru parameter, you can see the configurati
on of the VPN connection object.
PS C:\>Add-VpnConnection -Name "Test5" -ServerAddress "10.1.1.1" -TunnelType L2tp -EncryptionLevel Required -AuthenticationMethod Eap -SplitTunneling -AllUserConnecti
on -RememberCredential -EapConfigXmlStream $A.EapConfigXmlStream -PassThru
Name : Test5
ServerAddress : 10.1.1.1
AllUserConnection : True
Guid : {CF9F624F-D7DF-48BA-BD4B-D4E34AE05148}
TunnelType : L2tp
AuthenticationMethod : {Eap}
EncryptionLevel : Required
L2tpIPsecAuth : Certificate
UseWinlogonCredential : False
EapConfigXmlStream : #document
ConnectionStatus : Disconnected
NapState : NotConnected
RememberCredential : True
SplitTunneling : True



This set of commands adds a VPN connection using a custom EAP authentication method. For more information about custom EAP authentication methods, see the New-EapConf
iguration cmdlet.