MSI实现Silent安装自动化(转)

上一篇 / 下一篇  2014-05-28 15:21:24 / 个人分类:自动化测试

测试过程中自动化部署测试环境相对于人工进行部署可以节省很多的时间和精力,iquicktest主要为大家介绍如何使用WMI实现本地Silent安装自动化过程和远程Silent安装自动化过程,脚本很简单:

本机silent安装自动化:
'  本机机器silent安装软件
Const ALL_USERS = True
Set bjService = GetObject("winmgmts:")
Set bjSoftware = objService.Get("Win32_Product")
errReturn = objSoftware.Install("c:\iquicktest.msi", , ALL_USERS)

远程Silent安装自动化:
' 远程silent安装软件
Computer = "MyPC"
user = "MyPC\administrator"
pwd = "password"

Const wbemImpersonationLevelDelegate = 4
Set bjWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set bjConnection = objwbemLocator.ConnectServer _
    (Computer, "root\cimv2", user, _
         pwd)
objConnection.Security_.ImpersonationLevel = wbemImpersonationLevelDelegate

Set bjSoftware = objConnection.Get("Win32_Product")
errReturn = objSoftware.Install("\\shared\Setup\iquicktest.msi",,True)

TAG:

 

评分:0

我来说两句

Open Toolbar