cancel
Showing results for 
Search instead for 
Did you mean: 
Gary100
Pilgrim

Basic MSI Project to run a batch file or powershell script

Hello all,

I was wondering if you could point me into the right direction into an issue I'm having.
First of all, I'm fairly new to InstallShield and don't have a lot of experience besides creating a transform with the Tuner.
In our environment we have SCCM (2012R2) and for those of you who don't know, SCCM LOVES Msi-s and hates everything else.
What I'm trying to do is convert some SCCM packages into MSIs. Again, for those of you who are not familiar with SCCM, packages are a nice way of saying say "scripts".
I would like to convert these scripts into an MSI package.
Let's take the firefox installer as an example. It's an exe file. Is it possible to run a custom script during the MSI install to run this exe with a silent switch?
Also, can you run a MSI custom script, which runs a simple batch file or a powershell file during the MSI? Is this possible?

Thank you for any of your help.
Labels (1)
0 Kudos
9 Replies
Gary100
Pilgrim

Re: Basic MSI Project to run a batch file or powershell script

Here's what I have been able to accomplish so far (I'm using Install Shield 2016 by the way)

1. Created a basic MSI project.
2. In Installation Designer, under Files and Folder, I have added the Firefox executable to the directory where I'm installing it. (C:\Program Files x86\Company Name\Program Name\FirefoxFile.exe
3. Under custom actions I have created a new custom action (RunFirefoxSetup). I did this by selecting create a new exe with a Path referencing a directory.
4. The working directory is set to my folder where I'm installing the product in ProgramFiles.
5. The file name and command line is the full path to my folder "C:\Program Files (x86)\company name\Mozilla Firefox\FirefoxSetup52.2.0esr.exe" -ms
6. Return processing: Synchronous (Check exit code)
7. in-scrip execution: immediate execution
8. execution scheduling: always execute
9. under sequence I have chosen Install Exec Sequence After InstallFinalize.

This whole thing works just fine but the problem is that I get UAC prompts TWICE. The first time is when I lauch the MSI and the second time is when the Firefox executable is launched.

How can I suppress the UAC prompts in the executable?
0 Kudos
Gary100
Pilgrim

Re: Basic MSI Project to run a batch file or powershell script

I was able to fix it like this:

1. In-script execution: Commit execution in the system context
2. Install Exec Sequence: After InstallInitialize
3. Install Condition: Not Installed
0 Kudos
Maidens
Pilgrim

Sccm

Disagree that SCCM only loves MSI and hates everything else. Been using SCCM 2012 from release, creating hundreds of SCCM
Applications & Packages for deployments including MSI, MSP, EXE, VBscript, Autoit. SCCM deals with all of these with ease.

I understand the benefits of packaging into MSI format, but please be aware SCCM is capable of much more that your post suggests.
0 Kudos
rguggisberg
Active participant

Re: Basic MSI Project to run a batch file or powershell script

Gary100,
Have you considered using a Suite project to launch your various .EXE's and MSI's?
0 Kudos
Gary100
Pilgrim

Re: Basic MSI Project to run a batch file or powershell script

rguggisberg wrote:
Gary100,
Have you considered using a Suite project to launch your various .EXE's and MSI's?


No, I haven't and i'm not sure how to do that but I was considering it because I need to run DISM.exe at some point and I read in the InstallShield documentation that you could do that in a suite. I haven't gotten there yet but I will look into it.
So far, everything has been working well for me in terms of EXEs or batch files running them as custom actions.
During this process, I also found out that InstallShield (or the MSI engine) cannot write to Windows Protected Folder (where TrustedInstaller is the owner) so you HAVE to run custom actions and scripts to overcome this by using TAKEOWN and ICACLS commands.
I would appreciate your feedback on the suite though, if you could lay out some suggestions and details here.

Thanks !
0 Kudos
rguggisberg
Active participant

Re: Basic MSI Project to run a batch file or powershell script

Well if you pretty much have things working to your satisfaction I don't know that I would recommend switching to a Suite project. It is just another way of doing it, but there will be a bit of a learning curve if you have not used one before. You can execute InstallScript code via Events in a Suite project.To start a Suite project you just 'Create a new project' in the InstallShield IDE and select 'Suite / Advanced UI Project'. In a Suite you can execute DISM via a PowerShell Event. In you Basic MSI project you would execute DISM via a PowerShell CA.
0 Kudos
Gary100
Pilgrim

Re: Basic MSI Project to run a batch file or powershell script

rguggisberg wrote:
In a Suite you can execute DISM via a PowerShell Event. In you Basic MSI project you would execute DISM via a PowerShell CA.


Thank you. This line was helpful to me to understand the differences.
0 Kudos
Gary100
Pilgrim

Re: Basic MSI Project to run a batch file or powershell script

After reading this document: http://helpnet.installshield.com/installshield19helplib/helplibrary/CAPowerShell.htm I found out that you still need to run another batch file to run any un-signed .ps1 files.
In the batch file you have the luxury of running: Powershell.exe -executionpolicy unrestricted -File C:\myfilename.ps1
I don't understand Micro$oft sometimes with all these requirements into their MSI while allowing you to modify pretty much everything with a custom action.
And all of this work so SCCM is happy. When I was running LANDesk I wouldn't have to go through this ridiculousness.

0 Kudos
rguggisberg
Active participant

Re: Basic MSI Project to run a batch file or powershell script

Gary,
I agree with you. Actually I do just as you described (run PS from bat file). I just did not mention that because the world seems to be going in the PS direction. I do what I have to do to get the job done.
0 Kudos