Add-VpnConnection

Add-VpnConnection

Adds a VPN connection to the Connection Manager phone book.

Syntax

Parameter Set: InboxProfile
Add-VpnConnection [-Name] <String> [-ServerAddress] <String> [[-TunnelType] <String> ] [[-EncryptionLevel] <String> ] [[-AuthenticationMethod] <String[]> ] [[-SplitTunneling]] [[-AllUserConnection]] [[-L2tpPsk] <String> ] [[-RememberCredential]] [[-UseWinlogonCredential]] [[-EapConfigXmlStream] <XmlDocument> ] [-AsJob] [-CimSession <CimSession[]> ] [-DnsSuffix <String> ] [-Force] [-IdleDisconnectSeconds <UInt32> ] [-MachineCertificateEKUFilter <String[]> ] [-MachineCertificateIssuerFilter <X509Certificate2> ] [-PassThru] [-ServerList <CimInstance[]> ] [-ThrottleLimit <Int32> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: ThirdParty
Add-VpnConnection [-Name] <String> [-ServerAddress] <String> [[-SplitTunneling]] [[-RememberCredential]] [-PlugInApplicationID] <String> -CustomConfiguration <XmlDocument> [-AsJob] [-CimSession <CimSession[]> ] [-DnsSuffix <String> ] [-Force] [-IdleDisconnectSeconds <UInt32> ] [-PassThru] [-ServerList <CimInstance[]> ] [-ThrottleLimit <Int32> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detaillierte Beschreibung

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.

Parameter

-AllUserConnection

Indicates that the cmldet adds the VPN connection to the global phone book entries.

Aliasse

Keiner

Erforderlich?

false

Position?

8

Standardwert

Keiner

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-AsJob

Aliasse

Keiner

Erforderlich?

false

Position?

named

Standardwert

Keiner

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-AuthenticationMethod<String[]>

Specifies the authentication method to use for the VPN connection. Die folgenden Werte für diesen Parameter sind zulässig: PAP, CHAP, MSCHAPv2, or EAP.

Aliasse

Keiner

Erforderlich?

false

Position?

6

Standardwert

MSChapv2

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-CimSession<CimSession[]>

Führt das Cmdlet in einer Remotesitzung oder auf einem Remotecomputer aus. Geben Sie einen Computernamen oder ein Sitzungsobjekt ein, z. B. die Ausgabe eines Cmdlets New-CimSession oder Get-CimSession. Der Standardwert ist die aktuelle Sitzung auf dem lokalen Computer.

Aliasse

Session

Erforderlich?

false

Position?

named

Standardwert

Keiner

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-CustomConfiguration<XmlDocument>

Specifies an XML document that allows vendors to specify custom configuration information.

Aliasse

Keiner

Erforderlich?

true

Position?

named

Standardwert

Keiner

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-DnsSuffix<String>

Specifies the DNS suffix of the VPN connection.

Aliasse

Keiner

Erforderlich?

false

Position?

named

Standardwert

Keiner

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-EapConfigXmlStream<XmlDocument>

Specifies the contents of the EAP XML configuration file, which includes the EAP method ID.

Aliasse

Keiner

Erforderlich?

false

Position?

12

Standardwert

Keiner

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-EncryptionLevel<String>

Specifies the encryption level for the VPN connection. Die folgenden Werte für diesen Parameter sind zulässig: NoEncryption, Optional, Required and Maximum.

Aliasse

Keiner

Erforderlich?

false

Position?

5

Standardwert

Required

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-Force

Indicates that the pre-shared key (PSK) value is supplied over an insecure channel, if L2TP is used.

Aliasse

Keiner

Erforderlich?

false

Position?

named

Standardwert

Keiner

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-IdleDisconnectSeconds<UInt32>

Specifies the time, in seconds, before an idle connection is closed.

Aliasse

Keiner

Erforderlich?

false

Position?

named

Standardwert

Keiner

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-L2tpPsk<String>

Specifies the value of the PSK to be used for L2TP authentication. If this parameter is not specified, a certificate is used for L2TP.

Aliasse

Keiner

Erforderlich?

false

Position?

9

Standardwert

Keiner

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-MachineCertificateEKUFilter<String[]>

Specifies an array of enhanced key usage (EKU) filters for Internet Key Exchange version 2 (IKEv2) machine certificate selection.

Aliasse

Keiner

Erforderlich?

false

Position?

named

Standardwert

Keiner

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-MachineCertificateIssuerFilter<X509Certificate2>

Specifies the X509 certificate of the issuer filter for IKEv2 machine certificate selection.

Aliasse

Keiner

Erforderlich?

false

Position?

named

Standardwert

Keiner

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-Name<String>

Specifies the name of this VPN connection profile.

Aliasse

ConnectionName

Erforderlich?

true

Position?

2

Standardwert

Keiner

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-PassThru

Gibt ein Objekt zurück, das das Element darstellt, mit dem Sie arbeiten. Standardmäßig wird von diesem Cmdlet keine Ausgabe generiert.

Aliasse

Keiner

Erforderlich?

false

Position?

named

Standardwert

Keiner

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-PlugInApplicationID<String>

Specifies the identifier for a third party application.

Aliasse

Keiner

Erforderlich?

true

Position?

11

Standardwert

Keiner

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-RememberCredential

Indicates that the credentials supplied at the time of first successful connection are stored in the cache.

Aliasse

Keiner

Erforderlich?

false

Position?

10

Standardwert

Keiner

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-ServerAddress<String>

Specifies the address of the remote VPN server to which the client connects. You can specify the address as a URL, an IPv4 address, or an IPv6 address.

Aliasse

ServerName,DefaultServer

Erforderlich?

true

Position?

3

Standardwert

Keiner

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-ServerList<CimInstance[]>

Specifies an array of VPN servers. The VPN client can connect to these servers.

Aliasse

Keiner

Erforderlich?

false

Position?

named

Standardwert

Keiner

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-SplitTunneling

Indicates that the cmdlet enables split tunneling for this VPN connection profile. When you enable split tunneling, traffic to destinations outside the intranet does not flow through the VPN tunnel. If you do not specify this parameter, split tunneling is disabled.

Aliasse

Keiner

Erforderlich?

false

Position?

7

Standardwert

Keiner

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-ThrottleLimit<Int32>

Gibt die maximale Anzahl von gleichzeitigen Vorgängen an, die zum Ausführen dieses Cmdlets eingerichtet werden können. Wenn dieser Parameter ausgelassen oder der Wert 0 eingegeben wird, berechnet Windows PowerShell® einen optimalen Drosselungsgrenzwert für das Cmdlet basierend auf der Anzahl der CIM-Cmdlets, die auf dem Computer ausgeführt werden. Die Drosselungsgrenze gilt nur für das aktuelle Cmdlet und nicht für die Sitzung oder den Computer.

Aliasse

Keiner

Erforderlich?

false

Position?

named

Standardwert

Keiner

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-TunnelType<String>

Specifies the type of tunnel used for the VPN connection. Die folgenden Werte für diesen Parameter sind zulässig: PPTP, L2TP, SSTP, IKEv2, or Automatic.

Aliasse

Keiner

Erforderlich?

false

Position?

4

Standardwert

Automatic

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-UseWinlogonCredential

Indicates that MSCHAPv2 or EAP MSCHAPv2 is used as the authentication method, and that Windows logon credentials are used automatically when connecting with this VPN connection profile.

Aliasse

Keiner

Erforderlich?

false

Position?

11

Standardwert

Keiner

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-Confirm

Sie werden vor dem Ausführen des Cmdlets zur Bestätigung aufgefordert.

Erforderlich?

false

Position?

named

Standardwert

falsch

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-WhatIf

Zeigt, was geschieht, wenn das Cmdlet ausgeführt wird. Das Cmdlet wird nicht ausgeführt.

Erforderlich?

false

Position?

named

Standardwert

falsch

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

<CommonParameters>

Dieses Cmdlet unterstützt die allgemeinen Parameter: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, -OutVariable. Weitere Informationen finden Sie unter about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Eingaben

Der Eingabetyp ist der Typ der Objekte, die über die Pipeline an das Cmdlet übergeben werden können.

Ausgaben

Der Ausgabetyp ist der Typ der Objekte, die vom Cmdlet ausgegeben werden.

  • Microsoft.Management.Infrastructure.CimInstance#VpnConnection

    Das Microsoft.Management.Infrastructure.CimInstance-Objekt ist eine Wrapperklasse, die Objekte der Windows-Verwaltungsinstrumentation (WMI) anzeigt. Der Pfad nach dem Nummernzeichen (#) stellt den Namespace und den Klassennamen des zugrunde liegenden WMI-Objekts bereit.
    The VpnConnection object contains the VpnConnection configuration settings.

Beispiele

Example 1: Add a VPN connection

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.

PS C:\> Add-VpnConnection -Name "Test1" -ServerAddress "10.1.1.1" -PassThru

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

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.

PS C:\> Add-VpnConnection -Name "Test3" -ServerAddress "10.1.1.1" -TunnelType Pptp -EncryptionLevel Required -AuthenticationMethod MSChapv2 -UseWinlogonCredential -SplitTunneling -AllUserConnection  -RememberCredential -PassThru

Example 3: Add a VPN connection that uses EAP authentication

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.

PS C:\> Add-VpnConnection -Name "Test4" -ServerAddress "10.1.1.1" -TunnelType L2tp -EncryptionLevel Required -AuthenticationMethod Eap -SplitTunneling -AllUserConnection -L2tpPsk "password" -Force -RememberCredential -PassThru

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

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.

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

Verwandte Themen

Get-VpnConnection

Set-VpnConnection

Remove-VpnConnection

New-EapConfiguration