我正在PowerShell中创建VPN。
我想通过-AllEuserConnection
获取有关此VPN的信息,但尝试通过-Name
显示时出现错误。我试过这个名字的许多变化,但都没有成功。我需要按名称访问以在VPN上执行另一个命令。
下面是我得到的错误的例子:
PS C:\WINDOWS\system32> Add-VpnConnection -Name "USERVPN" -ServerAddress "123.456.789.123" -TunnelType L2tp -AuthenticationMethod Pap -EncryptionLevel Optional -L2tpPsk "UserKey" -Force -AllUserConnection
WARNING: The currently selected encryption level requires EAP or MS-CHAPv2 logon security methods. Data encryption will
not occur for Pap or Chap.
PS C:\WINDOWS\system32> Get-VpnConnection -AllUserConnection
Name : USERVPN
ServerAddress : 123.456.789.123
AllUserConnection : True
Guid : {8119DEDB-B9C1-4660-B3EA-5F14B0B2205D}
TunnelType : L2tp
AuthenticationMethod : {Pap}
EncryptionLevel : Optional
L2tpIPsecAuth : Psk
UseWinlogonCredential : False
EapConfigXmlStream :
ConnectionStatus : Disconnected
RememberCredential : False
SplitTunneling : False
DnsSuffix :
IdleDisconnectSeconds : 0
PS C:\WINDOWS\system32> Get-VpnConnection -Name "USERVPN"
Get-VpnConnection : VPN connection USERVPN was not found. : The system could not find the phone book entry for this
connection.
At line:1 char:1
+ Get-VpnConnection -Name "USERVPN"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (USERVPN:root/Microsoft/...S_VpnConnection) [Get-VpnConnection], CimExce
ption
+ FullyQualifiedErrorId : VPN 623,Get-VpnConnection
1条答案
按热度按时间goqiplq21#
在
Add-VpnConnection
Cmdlet上,您正在使用开关参数-AllUserConnection
,因此也需要在Get-VpnConnection
上调用它。您还需要在其他Cmdlet上调用它,如
Remove-VpnConnection
。在此测试: