使用VB脚本进行Flash安装

时间:2011-10-29 17:56:51

标签: vbscript flash

脚本编程,

我是VB脚本世界的新手!

我希望通过脚本完成以下操作,以便我可以安装Flash。

步骤如下: -

1.  Open Internet Options.
2.  Click on “Connections” tab.
3.  Click on “LAN Settings” button.
4.  Deselect the “Automatically Detect Settings” checkbox.
5.  Check the “Use a proxy server for your LAN (These settings will not apply to dial-up or VPN connections).” checkbox.
6.  Enter the address “172.16.3.150” in the “Address” text field and “80” in the “Port” text field.
7.  Check the “Bypass proxy server for local addresses” check box.
8.  Click “OK”, and “OK” again.
9.  Open “Internet Explorer” and navigate to “http://aihdownload.adobe.com/bin/install_flashplayer11x64ax_gtbd_aih.exe”
and open the file.

那么有可能让这一切都在脚本中运行吗?我想在GPO中使用它在所有客户端桌面上运行。

感谢您提供的任何帮助!非常感谢你!

1 个答案:

答案 0 :(得分:0)

您不需要IE及其gui在代理服务器后面发出http请求。您可以使用WinHttpRequest对象下载文件(包含代理信息,请参阅SetProxy) 的 e.g。

Const HTTPREQUEST_PROXYSETTING_PROXY = 2
Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2
Dim oHttp

Set oHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
With oHttp
    'Make request
    .SetTimeouts 5000,5000,5000,30000
    .SetProxy HTTPREQUEST_PROXYSETTING_PROXY, "172.16.3.150:80"
    .Open "GET", "http://aihdownload.adobe.com/bin/install_flashplayer11x64ax_gtbd_aih.exe", False
    .Send
    If oHttp.Status = 200 Then
        'Save Response
        With CreateObject("ADODB.Stream")
            .Open
            .Type = adTypeBinary
            .Write oHttp.ResponseBody
            .SaveToFile "C:\setup.exe", adSaveCreateOverWrite
            .Close
        End With
        'Run Executable
        CreateObject("WScript.Shell").Run "C:\setup.exe"
        WScript.Echo "Completed!"
    Else
        WScript.Echo "Download Failed"
    End If
End With
Set oHttp = Nothing