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

时间:2020-01-15 14:22:09

标签: azure automation windows-10 vpn azure-vpn

我在Windows 10上具有有效的Azure指向站点VPN。

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

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

1 个答案:

答案 0 :(得分:2)

您可以尝试使用这些对我有用的命令。

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

enter image description here