无法从 WiX 创建的 MSI 卸载程序 [英] Unable to uninstall program from WiX created MSI
问题描述
使用 WiXToolSet 制作的 MSI(使用 osquery 提供的脚本)安装 osquery 后,我尝试卸载它,但失败了.它也没有在 appwiz 中显示为程序.(链接到脚本 - https://github.com/osquery/osquery/blob/master/tools/deployment/make_windows_package.ps1)
After installing osquery with an MSI made with WiXToolSet (Using the script provided by osquery), I tried uninstalling it which failed. Also it didn't show as a program in the appwiz. (Link to the script - https://github.com/osquery/osquery/blob/master/tools/deployment/make_windows_package.ps1)
我尝试使用 MSI 本身 - osquery.msi/uninstall
和 unsintall 字符串 - msiexec/I{'uninstallstring'}
.我还尝试使用 /fv
选项进行修复.
I've tried using both the MSI itself - osquery.msi /uninstall
and the unsintall string - msiexec /I{'uninstallstring'}
.
I also tried repairing using the /fv
option.
脚本与 WiX 一起使用以创建 MSI 的代码:
The code the script used with WiX to create the MSI:
@'
<?xml version='1.0' encoding='windows-1252'?>
<?define OsqueryVersion = 'OSQUERY_VERSION'?>
<?define OsqueryUpgradeCode = 'ea6c7327-461e-4033-847c-acdf2b85dede'?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product
Name='osquery'
Manufacturer='Facebook'
'@
$wix += "`n Id='$(New-Guid)'`n"
$wix +=
@'
UpgradeCode='$(var.OsqueryUpgradeCode)'
Language='1033'
Codepage='1252'
Version='$(var.OsqueryVersion)'>
<Package Id='*'
Keywords='Installer'
Description='osquery standalone installer'
Comments='Facebooks opensource host intrusion detection agent'
Manufacturer='Facebook'
InstallerVersion='200'
Platform='x64'
Languages='1033'
Compressed='yes'
SummaryCodepage='1252' />
<MediaTemplate EmbedCab="yes" />
<MajorUpgrade
DowngradeErrorMessage="A later version of osquery is already installed. Setup will now exit." />
<Condition Message='A newer version of osquery is already installed.'>
NOT NEWERVERSIONDETECTED
</Condition>
<Condition Message="You need to be an administrator to install this product.">
Privileged
</Condition>
<Property Id='SOURCEDIRECTORY' Value='packs'/>
<PropertyRef Id="WIX_ACCOUNT_LOCALSYSTEM" />
<PropertyRef Id="WIX_ACCOUNT_USERS" />
<PropertyRef Id="WIX_ACCOUNT_ADMINISTRATORS" />
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFiles64Folder'>
<Directory Id='INSTALLFOLDER' Name='osquery'>
<Directory Id='DaemonFolder' Name='osqueryd'>
<Component Id='osqueryd'
Guid='41c9910d-bded-45dc-8f82-3cd00a24fa2f'>
<CreateFolder>
<Permission User="[WIX_ACCOUNT_USERS]" Read="yes"
ReadExtendedAttributes="yes" Traverse="yes"
ReadAttributes="yes" ReadPermission="yes" Synchronize="yes"
GenericWrite="no" WriteAttributes="no"/>
<Permission User="[WIX_ACCOUNT_ADMINISTRATORS]" GenericAll="yes"/>
<Permission User="[WIX_ACCOUNT_LOCALSYSTEM]" GenericAll="yes"/>
</CreateFolder>
<File Id='osqueryd'
Name='osqueryd.exe'
Source='OSQUERY_DAEMON_PATH'
KeyPath='yes'/>
<ServiceInstall Id='osqueryd'
Name='osqueryd'
Account='NT AUTHORITY\SYSTEM'
Arguments='--flagfile="C:\Program Files\osquery\osquery.flags"'
Start='auto'
Type='ownProcess'
Vital='yes'
ErrorControl='normal'/>
<ServiceControl Id='osqueryd'
Name='osqueryd'
Stop='both'
Start='install'
Remove='uninstall'
Wait='no'/>
</Component>
</Directory>
<Component Id='osqueryi' Guid='6a49524e-52b0-4e99-876f-ec50c0082a04'>
<File Id='osqueryi'
Name='osqueryi.exe'
Source='OSQUERY_SHELL_PATH'
KeyPath='yes'/>
</Component>
<Component Id='extras' Guid='3f435561-8fe7-4725-975a-95930c44d063'>
<File Id='osquery.conf'
Name='osquery.conf'
Source='OSQUERY_CONF_PATH'
KeyPath='yes'/>
<File Id='osquery.flags'
Name='osquery.flags'
Source='OSQUERY_FLAGS_PATH'/>
<File Id='osquery.man'
Name='osquery.man'
Source='OSQUERY_MAN_PATH'/>
<File Id='osquery_utils.ps1'
Name='osquery_utils.ps1'
Source='OSQUERY_UTILS_PATH'/>
<File Id='manage_osqueryd.ps1'
Name='manage-osqueryd.ps1'
Source='OSQUERY_MGMT_PATH'/>
'@
尝试使用 MSI 卸载时,我看到以下消息:无法打开此补丁包.验证补丁包是否存在并且您可以访问它,或联系应用程序供应商以验证这是一个有效的 Windows Installer 补丁包
尝试使用卸载字符串时,我看到以下消息:此操作仅对当前安装的产品有效
When trying to use the MSI to uninstall I saw the following message :
This patch package could not be opened. Verify that the patch package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer patch package
When trying to use the uninstall string I see this message:
This action is only valid for products that are currently installed
推荐答案
升级代码检索:如何找到升级代码安装了 MSI 文件?(如果您想使用其他软件包系列测试以下内容,请通过此处描述的方法查找升级代码).
Upgrade Code Retrieval: How can I find the Upgrade Code for an installed MSI file? (if you want to test the below with another package family, find upgrade code via methods described here).
<小时>
调试:要找到产品代码(前提是它确实已定义),也许可以尝试运行此代码:
Debugging: To find the product code (provided it is actually defined), maybe try to run this code:
Set installer = CreateObject("WindowsInstaller.Installer")
Set upgrades = installer.RelatedProducts("ea6c7327-461e-4033-847c-acdf2b85dede")
For Each u In upgrades
MsgBox u, vbOKOnly, "Product Code: "
Next
程序:1)
复制&将脚本粘贴到记事本中,2)
另存为ANSI文件:桌面查找相关产品.vbs",3)
双击脚本文件运行.记下消息框显示的产品代码(如果有).按 CTRL + C 复制实际 VBScript 对话框的内容.
Procedure: 1)
copy & paste the script into notepad, 2)
save as ANSI file: "Find Related Products.vbs" on desktop, 3)
double click script file to run. Make a note of the product codes shown by the message boxes (if any). Hit CTRL + C to copy content of the actual VBScript dialog.
卸载:来自cmd.exe
使用您通过运行上面的脚本找到的产品代码:
Uninstall: From the cmd.exe
using the product code you found by running the script above:
msiexec.exe /x {Product-Code}
<小时>
替代:如果您无法获得上述内容,请手动浏览 %SystemRoot%\Installer
工作,并遵循此处第 4 节中的建议.定位
正确的MSI,右击
然后去卸载"
.
Alternative: Browse through %SystemRoot%\Installer
manually if you can't get the above to work, and follow the advice in section 4 here. Locate
the right MSI, right click
and go "Uninstall"
.
链接:
这篇关于无法从 WiX 创建的 MSI 卸载程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!