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

Powershell Custom action problems. Please help

I'm trying to run the following command during an install to enable IIS if it is not enabled

Dism /Online /Enable-Feature /FeatureName:IIS-DefaultDocument /All

I can run this from Powershell with no problems but if I try a powershell custom action or even a launchappwait launching Powershell.exe I cannot make this work.

How can I get this command to work in an Installshield BasicMSI project? Are there some installscript commands I can use?

Thank you
Brandon
Labels (1)
Tags (2)
0 Kudos
2 Replies
rguggisberg
Active participant

Re: Powershell Custom action problems. Please help

Is this happening on Windows 10?
Is your InstallShield package a 32 bit package?
I ran into the same thing executing PS in a bat file. I found that you need to execute the 64 bit version of PS.
YES, there is a 32 bit and a 64 bit version! And if your IS package is 32 bit, it will execute the 32 bit version of PS!
Here's what I did in a bat file. Do the translation for your application.

REM To avoid error on Windows 10 we need to specify path to 64 bit PS as done below because our parent process is 32 bit.
SET "PSx64=" & REM Can't use sysnative on Server 2012 R2
IF "%WinVer%"=="10" SET "PSx64=%windir%\sysnative\WindowsPowerShell\v1.0\"
"%PSx64%POWERSHELL.EXE" ... rest of your PS command line
0 Kudos
Highlighted
Brandon_Lowe
Pilgrim

Re: Powershell Custom action problems. Please help

rguggisberg wrote:
Is this happening on Windows 10?
Is your InstallShield package a 32 bit package?
I ran into the same thing executing PS in a bat file. I found that you need to execute the 64 bit version of PS.
YES, there is a 32 bit and a 64 bit version! And if your IS package is 32 bit, it will execute the 32 bit version of PS!
Here's what I did in a bat file. Do the translation for your application.

REM To avoid error on Windows 10 we need to specify path to 64 bit PS as done below because our parent process is 32 bit.
SET "PSx64=" & REM Can't use sysnative on Server 2012 R2
IF "%WinVer%"=="10" SET "PSx64=%windir%\sysnative\WindowsPowerShell\v1.0\"
"%PSx64%POWERSHELL.EXE" ... rest of your PS command line


I will test this in just a little while and let you know how it goes. Running powershell and doing Dism commands from an install project is all new to me so I'm a little lost and have a project with a lot of IIS and Azure config to do.
0 Kudos