Solved

vbscript to install a .msi file

Posted on 2006-11-30
5
1,196 Views
Last Modified: 2012-05-05
I am trying to come up with a script to install a .msi file on 100+ machines.
I found the below from activexperts.com but keep getting an rpc error. I know it is becuase I am not using correct syntax....

The error is on line 3.. What should be the value for Set objConnection???

Const wbemImpersonationLevelDelegate = 4
Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objConnection = objwbemLocator.ConnectServer _
    ("WebServer", "root\cimv2", "fabrikam\administrator", _
     "password", , "kerberos:WebServer")
objConnection.Security_.ImpersonationLevel = wbemImpersonationLevelDelegate
Set objSoftware = objConnection.Get("Win32_Product")
errReturn = objSoftware.Install("\\atl-dc-02\scripts\1561_lab.msi",,True)
Wscript.Echo errReturn

Thanks for any help
0
Comment
Question by:andrew_89
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 26

Expert Comment

by:Pber
ID: 18047852
Try this one instead (specifically the "Script to Create (Start) a Process on a Computer"):

http://www.computerperformance.co.uk/vbscript/wmi_process_start.htm#Scenario_-_Why_you_need_to_Launch_a_Processes_on_a_Remote_Machine_

Works like a charm
0
 
LVL 1

Author Comment

by:andrew_89
ID: 18047888
How does it know where the .msi lives to execute on the remote machine
0
 
LVL 26

Accepted Solution

by:
Pber earned 500 total points
ID: 18047958
I main msiexec process will end up running under system.  that is the one that needs access to the file.

Thus I copy the msi to the remote machine first (\\machine\c$), then run the script, then remove the file.  I do this all in a batch

The strExe in the StartProcess.vbs would be

strExe = "msiexec /i c:\1561_lab.msi /qb"

I've modified the script slightly to allow me to use command line parameters.





0
 
LVL 1

Author Comment

by:andrew_89
ID: 18048232
Thanks alot that is very helpful !!!!



0
 
LVL 26

Expert Comment

by:Pber
ID: 18048714
I was also able to get the first script to work, but it you have to mess around with dcom on the PC sourcing the MSI.

On the MSI source
load dcomcnfg
Expand Component Services\Computers\My computer
Right click My Computer and select properties
Select the COM Security TAB
Select  the Edit Defaults of the Access Permissions
Grant System Remote Access.


;new vbs file
strcomputer="some machine"

Const wbemImpersonationLevelDelegate = 3 ;not change to 3 from 4
Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objConnection = objwbemLocator.ConnectServer (strComputer, "root\cimv2", , , , "kerberos:" & strComputer)
Wscript.Echo "Error: " & Err.Description
objConnection.Security_.ImpersonationLevel = wbemImpersonationLevelDelegate
Set objSoftware = objConnection.Get("Win32_Product")
errReturn = objSoftware.Install("\\MSIsource\share\some.msi",,True)
WScript.Echo(errReturn)

0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
home folder path for users 4 98
Moving RDP Server to New Server. 3 71
Domain Controller FSMO 7 73
Windows 2008 set profile 9 47
Numerous times I have been asked this questions that what is it that makes my machine log on so slow, there have been cases where computers took 23 minute exactly after taking password and getting to the desktop. Interesting thing was the fact th…
On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question