Add-VpnS2SInterface

Add-VpnS2SInterface

Creates a site-to-site (S2S) interface with the specified parameters.

Syntax

Parameter Set: EncryptionType
Add-VpnS2SInterface [-Name] <String> [-Destination] <String[]> [-AdminStatus <Boolean> ] [-AsJob] [-AuthenticationMethod <String> ] [-Certificate <X509Certificate2> ] [-CimSession <CimSession[]> ] [-EapMethod <String> ] [-EncryptionType <String> ] [-IdleDisconnectSeconds <UInt32> ] [-InternalIPv4 <Boolean> ] [-InternalIPv6 <Boolean> ] [-IPv4Subnet <String[]> ] [-IPv6Subnet <String[]> ] [-NetworkOutageTimeSeconds <UInt32> ] [-NumberOfTries <UInt32> ] [-PassThru] [-Password <String> ] [-PromoteAlternate <Boolean> ] [-Protocol <String> ] [-ResponderAuthenticationMethod <String> ] [-RetryIntervalSeconds <UInt32> ] [-SADataSizeForRenegotiationKilobytes <UInt32> ] [-SALifeTimeSeconds <UInt32> ] [-SharedSecret <String> ] [-ThrottleLimit <Int32> ] [-UserName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: CustomPolicy
Add-VpnS2SInterface [-Name] <String> [-Destination] <String[]> -CustomPolicy [-AdminStatus <Boolean> ] [-AsJob] [-AuthenticationMethod <String> ] [-AuthenticationTransformConstants <AuthenticationTransformConstants> ] [-Certificate <X509Certificate2> ] [-CimSession <CimSession[]> ] [-CipherTransformConstants <CipherTransformConstants> ] [-DHGroup <DHGroup> ] [-EapMethod <String> ] [-EncryptionMethod <EncryptionMethod> ] [-IdleDisconnectSeconds <UInt32> ] [-IntegrityCheckMethod <IntegrityCheckMethod> ] [-InternalIPv4 <Boolean> ] [-InternalIPv6 <Boolean> ] [-IPv4Subnet <String[]> ] [-IPv6Subnet <String[]> ] [-NetworkOutageTimeSeconds <UInt32> ] [-NumberOfTries <UInt32> ] [-PassThru] [-Password <String> ] [-PfsGroup <PfsGroup> ] [-PromoteAlternate <Boolean> ] [-Protocol <String> ] [-ResponderAuthenticationMethod <String> ] [-RetryIntervalSeconds <UInt32> ] [-SADataSizeForRenegotiationKilobytes <UInt32> ] [-SALifeTimeSeconds <UInt32> ] [-SharedSecret <String> ] [-ThrottleLimit <Int32> ] [-UserName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed Description

The Add-VpnS2SInterface cmdlet creates a site-to-site (S2S) interface with the specified parameters. Use the CustomPolicy parameter to customize IPsec settings. If the Protocol parameter is set to Automatic, then the only authentication method allowed is user name. If the AuthenticationMethod parameter is set to pre-shared key (PSK), then only one interface can be enabled per destination and the initiator and responder policies are governed by what is specified per interface. If the AuthenticationMethod parameter is set to user name or computer certificates (MachineCert), then only initiator policies are governed by what is specified per interface and responder policies are governed by what is specified on the server.

For incoming connections.
-- If the AuthenticationMethod parameter is set to PSK, the interface for which the destination IP matches the incoming IP is activated.
-- If the AuthenticationMethod parameter is set to user name, then the name of the interface that matches the user name is activated.
-- If the AuthenticationMethod parameter is set to certificates, then the name of the interface that matches the certificate subject name is activated.

Parameters

-AdminStatus<Boolean>

Specifies the administrator status of the cmdlet.

Aliases

none

Required?

false

Position?

named

Default Value

True

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-AsJob

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-AuthenticationMethod<String>

Specifies the authentication method to be used by the S2S connection.
If PSK is specified, then there can only be one active S2S VPN interface per destination IP address.

Aliases

none

Required?

false

Position?

named

Default Value

EAP

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-AuthenticationTransformConstants<AuthenticationTransformConstants>

Specifies the authentication transform for the IPsec policy.

Aliases

none

Required?

false

Position?

named

Default Value

2

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Certificate<X509Certificate2>

Specifies the certificate to be used in default store. Applicable only if AuthenticationMethod parameter is set to MachineCert.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CimSession<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.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CipherTransformConstants<CipherTransformConstants>

Specifies the cipher for the IPsec policy.

Aliases

none

Required?

false

Position?

named

Default Value

1

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-CustomPolicy

Specifies the custom IKE IPsec policies.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DHGroup<DHGroup>

Specifies the DH group for the IPsec policy.

Aliases

none

Required?

false

Position?

named

Default Value

2

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Destination<String[]>

Specifies the destination end point of the S2S connection.
Note: If the Certificate parameter is specified as PSK, then an IP address should be specified for this parameter as a fully qualified domain name (FQDN) will not work.

Aliases

none

Required?

true

Position?

3

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-EapMethod<String>

Specifies the EAP method if IkeLocalAuthenticationMethod is EAP.

Aliases

none

Required?

false

Position?

named

Default Value

MSCHAPv2

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-EncryptionMethod<EncryptionMethod>

Specifies the encryption method for the IKE policy.

Aliases

none

Required?

false

Position?

named

Default Value

4

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-EncryptionType<String>

Specifies the type of encryption.

Aliases

none

Required?

false

Position?

named

Default Value

RequireEncryption

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-IPv4Subnet<String[]>

Specifies the IPv4 subnet that is routed on this connection with metrics.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-IPv6Subnet<String[]>

Specifies the IPv6 subnet that is routed on this connection with metrics.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-IdleDisconnectSeconds<UInt32>

Specifies the time, in seconds, after which an idle connection is disconnected. Unless the idle time-out is Disabled, the entire connection is disconnected if the connection is idle for the specified interval.

Aliases

none

Required?

false

Position?

named

Default Value

300

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-IntegrityCheckMethod<IntegrityCheckMethod>

Specifies the integrity method for the IPsec policy.

Aliases

none

Required?

false

Position?

named

Default Value

2

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-InternalIPv4<Boolean>

Specifies that the IPv4 address should be negotiated.

Aliases

none

Required?

false

Position?

named

Default Value

True

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-InternalIPv6<Boolean>

Specifies that the IPv6 address should be negotiated.

Aliases

none

Required?

false

Position?

named

Default Value

True

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Name<String>

Specifies the name of the connection.

Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-NetworkOutageTimeSeconds<UInt32>

Specifies the maximum network outage time after which the connection is disconnected.

Aliases

none

Required?

false

Position?

named

Default Value

15

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-NumberOfTries<UInt32>

Specifies the number of connection attempts.
If this parameter is specified as zero (0), then the connection is not retried if the first attempt fails.

Aliases

none

Required?

false

Position?

named

Default Value

3

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-PassThru

Returns an object representing the item with which you are working. By default, this cmdlet does not generate any output.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Password<String>

Specifies the password for the user name to be used for dialing the connection. Applicable only if AuthenticationMethod parameter is set to EAP.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PfsGroup<PfsGroup>

Specifies the PFS group specified in the IPsec policy.

Aliases

none

Required?

false

Position?

named

Default Value

3

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-PromoteAlternate<Boolean>

Specifies an IP address that if successfully connected becomes the primary IP address, and the current primary IP address is moved to the alternate list.

Aliases

none

Required?

false

Position?

named

Default Value

False

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Protocol<String>

Specifies the underlying protocol used for tunneling.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-ResponderAuthenticationMethod<String>

Specifies the authentication method to be used by the S2S initiator to validate the S2S responder.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-RetryIntervalSeconds<UInt32>

Specifies the number of seconds between retries.

Aliases

none

Required?

false

Position?

named

Default Value

60

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-SADataSizeForRenegotiationKilobytes<UInt32>

Specifies the number of kilobytes that are allowed to transfer using a security association (SA). After that the SA will be renegotiated.

Aliases

none

Required?

false

Position?

named

Default Value

10000

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-SALifeTimeSeconds<UInt32>

Specifies the lifetime of a SA in seconds, after which the SA is no longer valid.

Aliases

none

Required?

false

Position?

named

Default Value

7200

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-SharedSecret<String>

Specifies the text of the shared secret to be used in the connection. This parameter is only applicable only if the AuthenticationMethod parameter is set to PSK or the ResponderAuthenticationMethod parameter is set to PSK.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ThrottleLimit<Int32>

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.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-UserName<String>

Specifies the user name to be used for the connection. Applicable only if AuthenticationMethod parameter is set to EAP.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before running the cmdlet.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • None

Outputs

The output type is the type of the objects that the cmdlet emits.

  • Microsoft.Management.Infrastructure.CimInstance#VpnS2SInterface

    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.

Examples

EXAMPLE 1

This example creates a S2S VPN interface named edge1 to the destination server 131.107.0.20. The protocol is IKEv2 and the authentication method is PSK. The string abc is used as PSK. Traffic to 10.2.0.0/24 and 2001:db8:2::/48 is sent over this interface if there is no other interface on the server that has same routes with a metric less than 100 . In case the interface is in disconnected state the connection is triggered if there is no other interface on the server that has same routes with a metric less than 100.

PS C:\> Add-VpnS2SInterface -Nameedge1 –Destination 131.107.0.20 -Protocol IKEv2 -AuthenticationMethod PSKOnly -SharedSecret abc -IPv4Subnet 10.2.0.0/24:100 -IPv6Subnet 2001:db8:2::/48:100

EXAMPLE 2

This example creates an interface that uses EAP authentication method and multiple subnets are routed on this interface including 131.0.1.0/24 and 121.0.0.0/16.

PS C:\> Add-VpnS2SInterface -IPv4Subnet @("131.0.1.0/24:254", "121.0.0.0/16:124") –UserName "abc@contoso.com" -Destination "30.0.0.1" -IPv6Subnet @("3ffe::/32:24", "2ffe::/32:24") -AuthenticationMethod "EAP" -Name "TestVpnS2SInterface" -RetryInterval 120 -EncryptionType "RequireEncryption" -InternalIPv4 1 -InternalIPv6 1 -NumberofTries 20 -AdminStatus $true -IdleDisconnectSeconds 300 -PromoteAlternate $true -Password "1111_aaaa" -PassThru

EXAMPLE 3

This example creates a S2S VPN interface using custom encryption settings.

PS C:\> Add-VpnS2SInterface -CustomPolicy -UserName "abc@contoso.com" -EncryptionMethod "AES128" -Destination "30.0.0.1" -Password "1111_aaaa" -DhGroup "Group2" -PfsGroup "PFS2" -CipherTransformConstants "AES128" -Name "TestVpnS2SInterface" -IntegrityCheckMethod "SHA256" -AuthenticationTransformConstants "SHA256128" -Protocol "IKEv2"

EXAMPLE 4

This example creates a S2S interface with authentication method of computer certificate and specifies the certificate for which the subject name is edge1.contoso.com.

PS C:\> $cert1 = Get-ChildItem -Path cert:LocalMachine\My | Where-Object –FilterScript { $_.Subject -Like "*CN=edge1.contoso.com*" }
PS C:\> Add-VpnS2SInterface –Name e1 -Destination 1.1.1.1 -AuthenticationMethod MachineCertificates -Certificate $cert1 -ResponderAuthenticationMethod MachineCertificates -Protocol IKEv2

Add-VpnS2SInterface

Clear-VpnS2SInterfaceStatistics

Connect-VpnS2SInterface

Disconnect-VpnS2SInterface

Get-VpnAuthProtocol

Get-VpnS2SInterface

Get-VpnS2SInterfaceStatistics

Get-VpnServerIPsecConfiguration

Remove-VpnS2SInterface

Set-VpnAuthProtocol

Set-VpnS2SInterface

Set-VpnServerIPsecConfiguration