windows - 在 PowerShell 中创建 VPN 连接

标签 windows powershell vpn l2tp

我正在使用以下 PowerShell 命令为 native Windows VPN 客户端创建 VPN 连接

Add-VpnConnection -Name "VPN" -ServerAddress "vpn.randomdomain.com" -TunnelType L2TP -L2tpPsk "SuperSecurePassword" -Force -AuthenticationMethod MSChapv2 -SplitTunneling $True -EncryptionLevel "Optional"

而且效果很好!但是,我也希望选中“自动使用我的 Windows 登录名和密码”(和域,如果有的话)复选框(在 MS-CHAP v2 下)。如何将其添加到我的命令中?

最佳答案

我自己找到了方法,在 MSChapv2 之后添加 -UseWinlogonCredential

足够简单!!

例子

Add-VpnConnection -Name "VPN" -ServerAddress "vpn.randomdoman.com" -TunnelType L2TP -L2tpPsk "SuperSecurePassword" -Force -AuthenticationMethod MSChapv2 -UseWinlogonCredential -SplitTunneling $True -EncryptionLevel "Optional"

关于windows - 在 PowerShell 中创建 VPN 连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46777369/

相关文章:

powershell - 使用 Powershell DSC 刷新环境变量{不起作用}!

windows - linux 和 windows 32 位系统的 int64_t 或 offset64 原型(prototype)

arrays - HTML 格式的报告 – 通过 PowerShell 发送电子邮件

regex - 在字符串中查找日期和时间并在 Windows 或 cmd 中使用 sed 重新格式化删除空格

powershell - PowerShell 中的停止器(程序执行期间耗时)

powershell - 如何在 PowerShell 二进制模块中捕获外部 DLL 的控制台输出?

ios - NEVPNManager 在 Swift 中连接到 VPN

c - 自己的简单VPN的数据包封装

dns - 带有 OpenVPN 的 Cloud DNS 无法在客户端上解析

c# - 如何在 C# 中与 Windows Media Player 交互