通过脚本连接到 Azure Point to Site VPN

Connect to Azure Point to Site VPN via Script

我在 Windows 10 上有一个可用的 Azure 点到站点 VPN。

有关说明,请参阅本指南:https://www.starwindsoftware.com/blog/configuring-azure-point-to-site-vpn-with-windows-10

我希望我的计算机在登录时建立 VPN 连接。我知道如何使 Task Scheduler 运行 成为登录时的脚本。我如何制作一个脚本来执行下图中所示的这两个手动步骤(在文章中提到)?

你可以试试这些对我有用的命令。

rasphone  "vNet_GET-CMD"
$wshell = New-Object -ComObject wscript.shell;
$wshell.AppActivate('Network Connections')
Sleep 2
$wshell.SendKeys('~')
Sleep 2
$wshell.SendKeys('~')