Share via


Add method of the PS_VpnConnection class

Adds a virtual private network (VPN) connection to the Connection Manager phone book.

Syntax

static uint32 Add(
  [in]  string           Name,
  [in]  string           ServerAddress,
  [in]  string           TunnelType,
  [in]  boolean          AllUserConnection,
  [in]  boolean          RememberCredential,
  [in]  uint32           IdleDisconnectSeconds,
  [in]  string           DnsSuffix,
  [in]  boolean          SplitTunneling,
  [in]  boolean          Force,
  [in]  boolean          PassThru,
  [in]  string           L2tpPsk,
  [in]  boolean          UseWinlogonCredential,
  [in]  string           EapConfigXmlStream,
  [in]  string           AuthenticationMethod[],
  [in]  string           EncryptionLevel,
  [in]  uint8            MachineCertificateIssuerFilter[],
  [in]  string           MachineCertificateEKUFilter[],
  [in]  VpnServerAddress ServerList[],
  [out] VpnConnection    cmdletOutput
);

Parameters

Name [in]

The name of the VPN connection profile to create.

ServerAddress [in]

The address of the remote VPN server that the client connects to. This address is a URL, a friendly name, an IPv4 address, or an IPv6 address. This should be one of the elements of ServerList.

TunnelType [in]

The tunnel type that is used in the RAS configuration. The tunnel type is decided after the first successful connection.

Ikev2 ("Ikev2")

Internet Key Exchange version 2 (IKEv2).

L2tp ("L2tp")

Layer 2 Tunneling Protocol (L2TP).

Pptp ("Pptp")

Point to Point Tunneling Protocol (PPTP).

Sstp ("Sstp")

Secure Socket Tunneling Protocol (SSTP).

AllUserConnection [in]

True if the VPN connection profile is for all users; false if it is for a single user.

RememberCredential [in]

True to store the credentials used for the first successful connection; otherwise, false.

IdleDisconnectSeconds [in]

The amount of idle time after which a connection is terminated. A value of 0 disables the time-out.

DnsSuffix [in]

The DNS suffix of the VPN connection.

SplitTunneling [in]

True to enable split tunneling for the VPN connection profile; otherwise, false.

Force [in]

True to force the supplying of the preshared key value over an unsecure channel, if L2TP is used; otherwise, false.

PassThru [in]

True to return the VpnConnection object that contains the VPN configuration settings; otherwise, false.

L2tpPsk [in]

The value of the preshared key to be used for L2TP authentication. If this parameter is not specified, a certificate is used for L2TP.

UseWinlogonCredential [in]

True if the Windows logon credentials for the user are automatically used for connection with the current VPN connection profile; otherwise, false.

This flag is only used for authentication protocols that involve MSCHAPv2.

EapConfigXmlStream [in]

The contents of the EAP XML configuration file, which includes the EAP method identifier.

AuthenticationMethod [in]

The authentication protocols to use for the VPN connection.

Chap ("Chap")

Challenge Handshake Authentication Protocol (CHAP).

Eap ("Eap")

Extensible Authentication Protocol (EAP).

MsChapv2 ("MsChapv2")

Microsoft Challenge Handshake Authentication Protocol version 2 (MSCHAPv2).

Pap ("Pap")

Password Authentication Protocol (PAP).

EncryptionLevel [in]

The encryption level for the VPN connection.

Maximum ("Maximum")

Maximum encryption.

NoEncryption ("NoEncryption")

No encryption.

Optional ("Optional")

Optional encryption.

Required ("Required")

Required encryption.

MachineCertificateIssuerFilter [in]

A filter based on the root certificate issuer to select the Machine Certificate for authentication. This property applies when IKEv2 tunnel type along with Machine Certificate authentication method is used.

MachineCertificateEKUFilter [in]

A filter based on the Certificate EKU Name or OID to select the Machine Certificate for authentication. This property applies when IKEv2 tunnel type along with Machine Certificate authentication method is used.

ServerList [in]

The VPN servers that the client can connect to.

cmdletOutput [out]

When this method returns, contains the VpnConnection object.

Requirements

Minimum supported client
Windows 8
Minimum supported server
Windows Server 2012
Namespace
Root\Microsoft\Windows\RemoteAccess\Client
MOF
VPNClientPSProvider.mof
DLL
VPNClientPSProvider.dll

See also

PS_VpnConnection