Solved

VBScript - Running multiple MSIs with supporting files from different folder in same script

Posted on 2013-05-16
7
945 Views
Last Modified: 2013-05-22
Hey guys,

I am writing a script that is supposed to call two MSIs in two different subfolders. This is necessary because whist these two MSIs are being run (one after the other) there is a splash screen that is displayed that needs to be closed after the MSIs are run.

Each MSI has supporting files and unfortunately because they are from the same application, the supporting file structures are the same, so they can't be put into the same folder to be executed.

The issue I am having is that when I execute an MSI it will start running, but error midway through because it cannot find the supporting files.

Is there a way to run these MSIs and have them recognise where they are being run from to pick up the remaining files (I hope that made sense).

Here's the part of my code that counts here:
Set objWShell = CreateObject("Wscript.Shell")
strFPInst = "C:\Windows\System32\Msiexec.exe /i FP4\ClientUpdate.msi /qn /l c:\build\logs\notesfp4.log"
strHFInst = "C:\Windows\System32\Msiexec.exe /i FP4_Hotfix\ClientUpdate.msi /qn /l c:\build\logs\notesfp4hotfix.log"

errCode = objWShell.Run(strFPInst, 1, True)
WScript.Sleep 10000
errCode = objWShell.Run(strHFInst, 1, True)

Open in new window

Hope someone can help.
Cheers,
G_M
0
Comment
Question by:G_M
  • 3
  • 3
7 Comments
 
LVL 42

Expert Comment

by:sedgwick
ID: 39171245
Windows Installer only allows a single MSI to be installing at a time, so u can't run simultaneously multiple MSI installers.
so its gotta be a sequential installation.
0
 

Author Comment

by:G_M
ID: 39171277
So this script does wait for on MSI to finish before running the second one. That is not the issue here, but thank you for the reply.
0
 
LVL 42

Expert Comment

by:sedgwick
ID: 39171311
what supporting files they are looking for?
can u copy the supporting files to the place the msi is run from?
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:G_M
ID: 39173112
The supporting files are already in the same folder as the MSI(s). The problem is that the script isn't on the same directory as the MSIs and therefor when the MSIis running, because it's not self contained, it can't find the rest of the files.

If I run  the script to the same directory as the MSI, it will execute fine.
0
 
LVL 65

Accepted Solution

by:
RobSampson earned 500 total points
ID: 39173825
Try inserting this as the second line:
objWShell.CurrentDirectory = "C:\Files\FP4ParentFolder"

to switch the shell to the directory it needs to be in (which should be the parent folder of the FP4 folder).

Rob.
0
 
LVL 42

Expert Comment

by:sedgwick
ID: 39173880
u have few options.
1. u can have the script copy it self to where the supporting files are and execute the MSI installers.
2. u can add installation folder when running the MSI installers.
add this parameter when running the MSI:
INSTALLDIR="<SupportingFilesDirectory">
3. you can have the script create separate, copy there the supporting files and the MSI installers and run them.
0
 

Author Closing Comment

by:G_M
ID: 39187067
@Sediwick, thanks for your response. I tried 2 and 3 of your options; however, they didn't do it for me. To be honest, the 1st option sounded a bit too hard for what it should be.

@robsampson, you were spot on with needing to switch the shell to the directory it needed to be in. I needed to do it twice though in order switch for both programs. I also added the "GetAbsolutePathName" to pck up the directory the script was running from. Thank you :o)

Here's my result:

Set objWShell = CreateObject("Wscript.Shell")
strCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
strFPInst = "C:\Windows\System32\Msiexec.exe /i ClientUpdate.msi /qn /l c:\build\logs\notesfp4.log"
strHFInst = "C:\Windows\System32\Msiexec.exe /i ClientUpdate.msi /qn /l c:\build\logs\notesfp4hotfix.log"

objWShell.CurrentDirectory = strCurPath & "\FP4"
errCode = objWShell.Run(strFPInst, 1, True)
WScript.Sleep 10000
objWShell.CurrentDirectory = strCurPath & "\FP4_Hotfix"
errCode = objWShell.Run(strHFInst, 1, True)

Open in new window

0

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup". After a while, you have entered a loop for Auto repair which does not fix anything and you will be in a  panic as all your work w…
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.

708 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now