首页 > 解决方案 > 登录脚本询问问题然后启动 vpn 连接

问题描述

我正在寻找具有以下逻辑/要求的登录脚本。

登录时弹出消息:您希望连接到 VPN,是/否?

如果是,则启动现有的 VPN 连接框,最终用户可以输入凭据,如果凭据已保存,则单击连接。

如果否,则框消失。

我从这个开始:

x=msgbox("Corporate VPN Connection", 4+32, "You must connect to the VPN when not physically in the office.  Do you wish to connect to the VPN now?")

显示框确定,但我需要进一步指导如何将按钮的单击链接到是/否功能。

谢谢!

标签: vbscript

解决方案


您可以通过以下代码开始:

Option Explicit
Dim Title,Message,Answer_Question

Title = "Corporate VPN Connection"
Message = "You must connect to the VPN when not physically in the office. Do you wish to connect to the VPN now ?"
Answer_Question = Msgbox(Message,VbQuestion+vbYesNo,Title)

If Answer_Question = vbYes Then 
    Wscript.echo "We are starting The VPN Connection"
Else 
' We quit the script
    Wscript.Quit
End If

推荐阅读