简体   繁体   English

从WIX安装程序执行dism batch命令

[英]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. 我创建了WIX msi安装程序,该安装程序使用dism.exe执行批处理命令以启用IIS Windows功能。 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: 当我执行msi安装程序时,执行的命令不会生效,并且所需的Windows功能也未启用,控制面板也不会显示已安装新的应用程序,但是当我使用命令行参数运行相同的msi安装程序时:

msiexec /i BatchFileExecutor.msi /Lime logfile.txt

the desired windows features get enabled and the control panel shows that the application is installed. 将启用所需的Windows功能,并且控制面板显示已安装该应用程序。

Below is the WIX code that I am using: 以下是我正在使用的WIX代码:

<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. 对我来说,customaction值属性似乎没有正确的“。”。请注意,QuietExecCA要求用完整的路径将EXE引号引起来,但我认为功能名称后不需要“”。

Also you don't want impersonation for your deferred CA. 另外,您也不想假冒您的延迟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. 最后,我将确保包括一些开关,这些开关可以防止DISM在安装过程中强制重新启动。 Some windows features take a reboot to become effective. 某些Windows功能需要重新启动才能生效。 For this reason I put DISM commands as their own package inside of a bootstrapper bundle / chain outside of my MSI. 因此,我将DISM命令作为它们自己的包放在MSI外部的引导程序包/链中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Wix 安装程序自定义操作运行 dism 失败 - Wix installer custom action for running dism failing 如何从启用了“以管理员身份运行”的基于 WiX 的安装程序安装桌面快捷方式(到批处理文件)? - How to install a desktop shortcut (to a batch file) from a WiX-based installer that has “Run as Administrator” enabled? Gawk命令未从批处理文件执行,但在命令行上正常 - Gawk command not executing from batch file but fine at command line 从批处理文件执行gradle命令时关闭命令窗口 - Command window closing while executing gradle command from batch file WIX-在安装程序中执行python文件,而无需移至INSTALLDIR - WIX - Executing python file inside installer without moving to INSTALLDIR 在批处理文件中执行复制命令 - executing copy command in a batch file 在批处理文件中执行第二个命令 - executing a second command in a batch file 通过命令行/通过 Jenkins “执行批处理命令”创建安装程序 - Creating an installer via command line / through Jenkins “Execute Batch Command” 从 wix 安装程序卸载期间的注册表读取/删除顺序 - Order of registry read/remove during uninstall from a wix installer 尝试从 wix 安装程序运行多个 powershell 脚本 - Trying to run the multiple powershell scripts from wix installer
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM