jcl43 0 Newbie Poster

Hi all I have a script I am using to install an msi on a remote machine. I need it to run the installer, then wait until it finishes before moving on the rest of the script.

does objSoftware.Install do this or would I have to sleep for x seconds until it is done?

Here is the line in question

' Run the MFEAgent.msi
strComputer="HCSXW" & PcID
iName="NET USE X: \\" & strComputer & "\C$ " & strPassword & " /USER:" & strDomain & "\" & strUser
objShell.Run iName

' wscript.quit

Set objFolder = objFSO.GetFolder("X:\Documents and Settings\All Users\Application Data\McAfee\Common Framework")
if Err.Number <> vbEmpty then
 strFile=":\Documents and Settings\All Users\Application Data\McAfee\Common Framework"
else
 strFile=":\Documents and Settings\All Users\Application Data\Network Associates\Common Framework"
end if

Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objSWbemServices = objSWbemLocator.ConnectServer(strComputer,"root\cimv2", strUser, strPassword, "MS_409", "ntlmdomain:" + strDomain)
Set objSoftware = objSWbemServices.Get("Win32_Product")
Set objScriptExec = errReturn = objSoftware.Install("C" & strFile & "\MFEagent.msi",,True)


set objSWbemLocator=Nothing
set objSWbemServices=Nothing
set ObjSoftware=Nothing

Any help is appreciated.