PowerShell Logo Small

Add-VpnConnection



This is the built-in help made by Microsoft for the command 'Add-VpnConnection', in PowerShell version 3 - as retrieved from Windows version 'Microsoft Windows Server 2012 Standard' 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] [<SwitchParameter>]] [[-UseWinlogonCredential] [<SwitchParameter>]] [[-EapConfigXmlStream]
<XmlDocument>] [-Name] <String> [-ServerAddress] <String> [[-TunnelType] <String>] [[-EncryptionLevel] <String>] [[-AuthenticationMethod]
<String[]>] [[-SplitTunneling] [<SwitchParameter>]] [[-AllUserConnection] [<SwitchParameter>]] [[-L2tpPsk] <String>] [-AsJob
[<SwitchParameter>]] [-CimSession <CimSession[]>] [-Force [<SwitchParameter>]] [-PassThru [<SwitchParameter>]] [-ThrottleLimit <Int32>]
[-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]] [<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 error information is returned.



<

RELATED LINKS

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 VPN 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 -SplitTunneling -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

PS C:\> Add-VpnConnection -Name "Test4" -ServerAddress "10.1.1.1" -TunnelType L2tp -EncryptionLevel Required -AuthenticationMethod Eap
-SplitTunneling -AllUserConnection -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, password, 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

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 method specifying the EapConfigXmlStream parameter, and using the EapConfigXmlStream method of the $a variable
created earlier. 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.
PS C:\> Add-VpnConnection -Name "Test5" -ServerAddress "10.1.1.1" -TunnelType L2tp -EncryptionLevel Required -AuthenticationMethod Eap
-SplitTunneling -AllUserConnection -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-EapConfiguration cmdlet.