Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
Set-VpnConnection
- Module:
- VpnClient Module
Changes the configuration settings of an existing VPN connection profile.
Syntax
InboxProfile (Default)
Set-VpnConnection
[-Name] <String>
[[-ServerAddress] <String>]
[[-SplitTunneling] <Boolean>]
[[-RememberCredential] <Boolean>]
[[-TunnelType] <String>]
[[-L2tpPsk] <String>]
[[-AuthenticationMethod] <String[]>]
[[-EapConfigXmlStream] <XmlDocument>]
[[-UseWinlogonCredential] <Boolean>]
[[-EncryptionLevel] <String>]
[-AllUserConnection]
[-PassThru]
[-Force]
[-MachineCertificateEKUFilter <String[]>]
[-MachineCertificateIssuerFilter <X509Certificate2>]
[-ServerList <CimInstance[]>]
[-IdleDisconnectSeconds <UInt32>]
[-DnsSuffix <String>]
[-CimSession <CimSession[]>]
[-ThrottleLimit <Int32>]
[-AsJob]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ThirdParty
Set-VpnConnection
[-Name] <String>
[[-ServerAddress] <String>]
[[-SplitTunneling] <Boolean>]
[[-RememberCredential] <Boolean>]
[[-PlugInApplicationID] <String>]
[-PassThru]
[-Force]
[-ServerList <CimInstance[]>]
[-IdleDisconnectSeconds <UInt32>]
[-DnsSuffix <String>]
[-CustomConfiguration <XmlDocument>]
[-ThirdPartyVpn]
[-CimSession <CimSession[]>]
[-ThrottleLimit <Int32>]
[-AsJob]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Set-VpnConnection cmdlet changes the configuration settings of an existing VPN connection profile. If the VPN profile specified does not exist, you see an error. If errors occur when you modify the VPN profile, the cmdlet returns the error information.
Examples
Example 1: Configure a single VPN connection
PS C:\> Set-VpnConnection -Name "Test1" -ServerAddress "10.1.1.2" -PassThru
Name : Test1
ServerAddress : 10.1.1.2
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 configures the VPN connection named Test1 to connect to the server with an IP address of 10.1.1.2. By specifying the PassThru parameter, you can see the configuration of the VPN connection object.
Example 2: Configure a VPN connection with several settings
PS C:\>Set-VpnConnection -Name "Test3" -AllUserConnection -TunnelType "L2tp" -EncryptionLevel "Optional" -AuthenticationMethod Pap -SplitTunneling $False -RememberCredential $False -PassThru
WARNING: The currently selected encryption level requires EAP or MS-CHAPv2 logon security methods. Data encryption will not occur for Pap or Chap.
Name : Test3
ServerAddress : 10.1.1.1
AllUserConnection : True
Guid : {76746D4E-D72A-467D-A11F-3D4D9075F50D}
TunnelType : L2tp
AuthenticationMethod : {Pap}
EncryptionLevel : Optional
L2tpIPsecAuth : Certificate
UseWinlogonCredential : False
EapConfigXmlStream :
ConnectionStatus : Disconnected
NapState : NotConnected
RememberCredential : False
SplitTunneling : False
This command configures the VPN connection named Test3 and located in the global phone book as follows:
- The connection is configured to use L2tp as the tunnel type, as specified by the TunnelType parameter
- The tunnel is using optional encryption, as specified by the EncryptionLevel parameter
- The authentication method used by the connection is PAP, as specified by the AuthenticationMethod parameter
- Split tunneling is turned off, as specified by the SplitTunneling parameter, and the value of $False
- Credential caching is turned off, as specified by the RememberCredential parameter and the value of $False
By specifying the PassThru parameter, you can see the configuration of the VPN connection object.
Example 3: Configure a VPN connection to use a custom EAP configuration
This command stores the result of **New-EapConfiguration** into the variable named $A.
PS C:\>$A = New-EapConfiguration -Tls
This command configures the VPN connection named Test4 in the global phone book to use the custom EAP configuration by:
-- Specifying the *AuthenticationMethod* parameter with the value EAP
-- Specifying the *EapConfigXmlStream* parameter with the value of the *EapConfigXmlStream* method of the previously created variable.By specifying the *PassThru* parameter, you can see the configuration of the VPN connection object.
PS C:\>Set-VpnConnection -Name "Test4" -AllUserConnection -AuthenticationMethod Eap -EapConfigXmlStream $A.EapConfigXmlStream -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 set of commands first creates a custom EAP configuration, and then configures a VPN connection from the global phone book to use the new custom EAP configuration.
For more information about custom EAP creation, see the New-EapConfiguration cmdlet.
Parameters
-AllUserConnection
Indicates that the VPN connection specified is in the global phone book.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-AsJob
Runs the cmdlet as a background job. Use this parameter to run commands that take a long time to complete.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-AuthenticationMethod
Specifies the authentication method to use for the VPN connection. The acceptable values for this parameter are:
- PAP
- CHAP
- MSCHAPv2
- EAP
Parameter properties
| Type: | String[] |
| Default value: | None |
| Accepted values: | Pap, Chap, MSChapv2, Eap, MachineCertificate |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-CimSession
Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.
Parameter properties
| Type: | CimSession[] |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | Session |
Parameter sets
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
| Type: | SwitchParameter |
| Default value: | False |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | cf |
Parameter sets
-CustomConfiguration
Specifies an XML document that allows vendors to specify custom configuration information.
Parameter properties
| Type: | XmlDocument |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-DnsSuffix
Specifies the DNS suffix of the VPN connection.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-EapConfigXmlStream
Specifies the contents of the EAP XML configuration file, which includes the EAP method ID.
Parameter properties
| Type: | XmlDocument |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-EncryptionLevel
Specifies the encryption level for the VPN connection. The acceptable values for this parameter are:
- NoEncryption
- Optional
- Required
- Maximum
Parameter properties
| Type: | String |
| Default value: | None |
| Accepted values: | NoEncryption, Optional, Required, Maximum, Custom |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Force
Indicates that the pre-shared key (PSK) value is supplied over an insecure channel, if L2TP is used.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-IdleDisconnectSeconds
Specifies the time, in seconds, before closing an idle connection.
Parameter properties
| Type: | UInt32 |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-L2tpPsk
Specifies the value of the PSK to be used for L2TP authentication. If this parameter is not specified, a certificate is used for L2TP.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-MachineCertificateEKUFilter
Specifies an array of enhanced key usage (EKU) filters for Internet Key Exchange version 2 (IKEv2) machine certificate selection.
Parameter properties
| Type: | String[] |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-MachineCertificateIssuerFilter
Specifies the X509 certificate of the issuer filter for IKEv2 machine certificate selection.
Parameter properties
| Type: | X509Certificate2 |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Name
Specifies the name of the VPN connection profile.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | ConnectionName |
Parameter sets
-PassThru
Returns an object representing the item with which you are working. By default, this cmdlet does not generate any output.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-PlugInApplicationID
Specifies the identifier for a third party application.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-RememberCredential
Indicates that the credentials supplied at the time of first successful connection is stored in the cache, if set to $True.
Parameter properties
| Type: | Boolean |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ServerAddress
Specifies the address of the remote VPN server to which the client connects. You can specify the address as a fully qualified domain name (FQDN), an IPv4 address, or an IPv6 address.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | ServerName, DefaultServer |
Parameter sets
-ServerList
Specifies an array of VPN servers. The VPN client can connect to these servers.
Parameter properties
| Type: | CimInstance[] |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-SplitTunneling
Indicates whether the cmdlet enables split tunneling for the VPN connection profile. When you enable split tunneling, traffic to destinations outside the intranet does not flow through the VPN tunnel. Specify a value of $True to enable split tunneling.
Parameter properties
| Type: | Boolean |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ThirdPartyVpn
Indicates that the cmdlet runs for a third party profile.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ThrottleLimit
Specifies the maximum number of concurrent operations that can be established to run the cmdlet.
If this parameter is omitted or a value of 0 is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer.
The throttle limit applies only to the current cmdlet, not to the session or to the computer.
Parameter properties
| Type: | Int32 |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-TunnelType
Specifies the type of tunnel used for the VPN connection. The acceptable values for this parameter are:
- PPTP
- L2TP
- SSTP
- IKEv2
- Automatic
Parameter properties
| Type: | String |
| Default value: | None |
| Accepted values: | Pptp, L2tp, Sstp, Ikev2, Automatic |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-UseWinlogonCredential
Indicates whether to use Windows logon credentials. Specify a value of $True to use MSCHAPv2 or EAP-MSCHAPv2 as the authentication method and use Windows logon credentials automatically when connecting with the VPN connection profile.
Parameter properties
| Type: | Boolean |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Parameter properties
| Type: | SwitchParameter |
| Default value: | False |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | wi |
Parameter sets
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Outputs
CimInstance
The Microsoft.Management.Infrastructure.CimInstance object is a wrapper class that displays Windows Management Instrumentation (WMI) objects.
The path after the pound sign (#) provides the namespace and class name for the underlying WMI object.
This cmdlet returns a VpnConnection object that contains the VPN connection configuration settings.
Related Links
Feedback
Was this page helpful?
