简体   繁体   中英

Executing dism batch command from WIX installer

I have created a WIX msi installer which executes a batch command using dism.exe to enable IIS windows features. When I execute the msi installer the executed command doesn't take effect and the desired windows features are not enabled also the control panel doesn't show that a new application is installed, but when I run the same msi installer using command line arguments:

msiexec /i BatchFileExecutor.msi /Lime logfile.txt

the desired windows features get enabled and the control panel shows that the application is installed.

Below is the WIX code that I am using:

<CustomAction Id="BatchCmd"
              Property="BatchRun"
              Value='"[WindowsFolder]Sysnative\dism.exe" /Online /Enable-Feature /FeatureName:IIS-WebServerRole"' 
              Execute='immediate' 
              Return='check'>
</CustomAction>

<CustomAction Id="BatchRun" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="check" Impersonate="yes">
</CustomAction>

<InstallExecuteSequence>
  <Custom Action="BatchCmd" Before="BatchRun">NOT Installed</Custom>
  <Custom Action="BatchRun" After="InstallFiles">NOT Installed</Custom>
</InstallExecuteSequence>

Is there some code fragment out of place or have I wrongly set some property?

The customaction value attribute doesn't seem to have the right number of "'s to me. Note that QuietExecCA requires a full path wrapped in quotes for the EXE but I don't think there's any need for a " after the feature name.

Also you don't want impersonation for your deferred CA. You want no impersonation so it runs elevated in the system context.

Finally I'd be sure to include switches that prevent DISM from forcing a reboot during the middle of your installation. Some windows features take a reboot to become effective. For this reason I put DISM commands as their own package inside of a bootstrapper bundle / chain outside of my MSI.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM