我知道在Wix和PowerShell脚本上有几个帖子,但在尝试从这些帖子中获得解决方案后,我仍然没有得到我期望的结果。为了解释我的情况,我创建了一个Wix安装项目,它将从我的本地计算机(运行Windows 7)中获取2个Powershell脚本和一个msu文件,并将这些文件捆绑到一个msi文件中。如果我在我的测试虚拟机上运行msi文件(运行windows server 2008 r2),文件将被复制到其指定的目录中。大。在添加/删除程序列表中有一个新项目显示有一个缺点,但是这将是我稍后将要处理的事情。Wix - 安装并运行powershell脚本
-
我已经试过得到复制到目标机器的文件后做(的PowerShell脚本将安装MSU,编辑配置文件和启动服务手动运行时正常工作)运行其中一个复制的Powershell脚本,但到目前为止我还无法实现这一点。
我.wxs代码如下所示(编写和编译使用TFS 2010)
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Id="a89cc681-d617-43ea-817e-1db89b941bf2" Name="Test1" Language="1033" Version="1.0.0.0" Manufacturer="Test1" UpgradeCode="d8db2663-2567-4bb8-9023-09988838eb55">
<Package InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<!-- Set up the directory -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="IISTIERINSTALLATION" Name="IISTierInstallation">
</Directory>
</Directory>
<!-- Copy the files -->
<DirectoryRef Id="IISTIERINSTALLATION">
<Component Id ="C2WTS_update_file" Guid="11960C39-12EB-4777-B43F-394ADB352DD3">
<File Id="C2WTSmsu" Name="Windows6.1-KB974405-x64.msu" Source="C:\PS Scripts\Windows6.1-KB974405-x64.msu" />
</Component>
<Component Id ="C2WTSInstallScript" Guid="C85ED4DB-BDC1-4DD1-84FE-41D7463C6365">
<File Id="C2WTSscript1" Name="C2WTS_service_install.ps1" Source="C:\PS Scripts\C2WTS_service_install.ps1" />
</Component>
<Component Id ="C2WTSxmlScript" Guid="AF1F85A7-88F7-4BBA-89D9-6817CFAA74F9">
<File Id="C2WTSscript2" Name="Edit_c2wts_config.ps1" Source="C:\PS Scripts\Edit_c2wts_config.ps1" />
</Component>
</DirectoryRef>
<Feature Id="ProductFeature" Title="Test1" Level="1">
<ComponentRef Id="C2WTS_update_file" />
<ComponentRef Id="C2WTSInstallScript" />
<ComponentRef Id="C2WTSxmlScript" />
<ComponentGroupRef Id="Product.Generated" />
</Feature>
<!-- Run custom action to run the powershell script-->
<Property Id="POWERSHELLEXE">
<RegistrySearch Id="POWERSHELLEXE"
Type="raw"
Root="HKLM"
Key="SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell"
Name="Path" />
</Property>
<SetProperty Id="RunPSscript"
After="InstallFiles"
Sequence="execute"
Value =""[POWERSHELL.EXE]" -Version 2.0 -NoProfile -NonInteractive -InputFormat None -ExecutionPolicy Bypass -Command "& '[#C2WTS_service_install.ps1]' ; exit $$($Error.Count)"" />
<CustomAction Id="RunPSscript"
BinaryKey="WixCA"
DllEntry="CAQuietExec"
Execute="deferred"
Return="check"
Impersonate="yes" />
<Custom Action="RunPSscript" After="InstallFiles">
<![CDATA[NOT Installed]]>
</Custom>
</Product>
</Wix>
由于添加自定义活动开展PowerShell脚本,当我运行MSI没有任何反应。这些文件不像以前那样出现在他们的文件夹中,也没有安装任何文件。谁能告诉我我要去哪里?至于说,有关于类似问题的净几种解决方案,但至今没有一个为我工作
UPDATE
我试图安装MSI与日志功能和日志返回以下2行:
CAQuietExec64:错误80070057:无法获得命令行数据
CAQuietExec64:错误80070057:无法获得命令行
在网络中搜索该错误代码的修复程序后,仍然没有找到任何解决此问题的答案。任何人有任何想法?任何Wix专家在那里?
在此先感谢
通过生成安装日志(运行msiexec.exe/i {您的msi文件在这里}/log {日志路径})开始故障排除。 – Dan