WIX installer uninstalls but not installs if previous version is installed - wix

I'm having a problem with installer which happens only if previous version exist on the computer. Installer created using WiX-toolset.
If previous version exists, my installer uninstalls it successfully but then ends prematurely. If started again installs with no problems. If no previous version installs successfully.
Log file ends with following lines
Product: xxxxx -- Installation failed.
MSI (c) (AC:3C) [22:53:59:388]: Windows Installer installed the product. Product Name: xxxxx. Product Version: 1.2.0.0. Product Language: 1033. Manufacturer: xxxxx xxx. Installation success or error status: 1603.
MSI (c) (AC:3C) [22:53:59:389]: Grabbed execution mutex.
MSI (c) (AC:3C) [22:53:59:389]: Cleaning up uninstalled install packages, if any exist
MSI (c) (AC:3C) [22:53:59:393]: MainEngineThread is returning 1603
MSI (c) (AC:80) [22:53:59:400]: RESTART MANAGER: Previously shut down applications have been restarted.
MSI (c) (AC:80) [22:53:59:401]: RESTART MANAGER: Session closed.
The log files is huge. There are some suspicious lines like
DEBUG: Error 2911: Could not remove the folder C:\Config.Msi\.
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2911. The arguments are: C:\Config.Msi\, ,
There are no such directory.
Looking into log file I have a feeling that installer doesn't start after uninstallation instead it is trying to start application, which is set for automatic run after installation. This returns error 1603
MSI (s) (2C:08) [22:53:51:928]: PROPERTY CHANGE: Deleting UpdateStarted property. Its current value is '1'.
Action ended 22:53:51: InstallFinalize. Return value 1.
MSI (s) (2C:08) [22:53:51:929]: Doing action: LaunchApplication
MSI (s) (2C:08) [22:53:51:929]: Note: 1: 2205 2: 3: ActionText
Action 22:53:51: LaunchApplication.
Action start 22:53:51: LaunchApplication.
MSI (s) (2C:F8) [22:53:51:931]: Invoking remote custom action. DLL: C:\WINDOWS\Installer\MSI87DC.tmp, Entrypoint: WixShellExec
MSI (s) (2C:DC) [22:53:51:931]: Generating random cookie.
MSI (s) (2C:DC) [22:53:51:932]: Created Custom Action Server with PID 8100 (0x1FA4).
MSI (s) (2C:00) [22:53:51:947]: Running as a service.
MSI (s) (2C:00) [22:53:51:948]: Hello, I'm your 32bit Impersonated custom action server.
WixShellExec: Error 0x80070002: ShellExec failed with return code 2
WixShellExec: Error 0x80070002: failed to launch target
CustomAction LaunchApplication returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Action ended 22:53:51: LaunchApplication. Return value 3.
Action ended 22:53:51: INSTALL. Return value 3.
Any help is appreciated. Any ideas what to look for in log file in my case.

I think I found what is happening. In my previous installer I used a custom action to run program after installation like this
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes"/>
<InstallExecuteSequence>
<Custom Action="LaunchApplication" After="InstallFinalize"/>
</InstallExecuteSequence>
!!! I should use condition NOT Installed to run this action only on installation, but not during uninstallation. Like this
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes"/>
<InstallExecuteSequence>
<Custom Action="LaunchApplication" After="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>
If I used it in my previous version I would not have this problem now.

Related

WIX MSI: I Want to show a message to user "Product is already Installed" if user runs the installer again

I am creating an MSI installer, during testing the same if I am running the installer for the first time the installer works as expected. But when I accidentally run the installer, it uninstalled my files.
So, for that, I had modified the condition and added Remove="All" in the condition of the actions.
Which is working fine, but I want to show a message to the User that the product is already installed.
So, for that, I added the below piece of code:
<Upgrade Id='<<Upgrade Code>>'>
<UpgradeVersion OnlyDetect='yes' Property='SELFFOUND'
Minimum='1.0.1' IncludeMinimum='yes' Maximum='1.0.1' IncludeMaximum='yes' />
<UpgradeVersion OnlyDetect='yes' Property='NEWERFOUND'
Minimum='1.0.1' IncludeMinimum='no' />
</Upgrade>
<CustomAction Id='AlreadyUpdated' Error='[ProductName] is already installed.' />
.....
.....
.....
.....
.....
<InstallExecuteSequence>
<Custom Action='AlreadyUpdated' After='FindRelatedProducts'>SELFFOUND</Custom>
</InstallExecuteSequence>
But when running this, the installer is still running for the second time and not giving the message.
On checking the logs, could see that the "FindRelatedProducts" skipped with the below message:
MSI (c) (F4:1C) [06:18:04:806]: Doing action: FindRelatedProducts
MSI (c) (F4:1C) [06:18:04:806]: Note: 1: 2205 2: 3: ActionText
Action 6:18:04: FindRelatedProducts. Searching for related applications
Action start 6:18:04: FindRelatedProducts.
MSI (c) (F4:1C) [06:18:04:806]: Skipping FindRelatedProducts action: not run in maintenance mode
Action ended 6:18:04: FindRelatedProducts. Return value 0.
and
MSI (s) (18:14) [06:18:05:500]: Running ExecuteSequence
MSI (s) (18:14) [06:18:05:500]: Doing action: FindRelatedProducts
MSI (s) (18:14) [06:18:05:500]: Note: 1: 2205 2: 3: ActionText
Action 6:18:05: FindRelatedProducts. Searching for related applications
Action start 6:18:05: FindRelatedProducts.
MSI (s) (18:14) [06:18:05:507]: Skipping FindRelatedProducts action: already done on client side
Action ended 6:18:05: FindRelatedProducts. Return value 0.
The condition in AlreadyUpdated custom action also does not satisfy.
MSI (s) (18:14) [06:18:05:737]: Doing action: PublishProduct
MSI (s) (18:14) [06:18:05:737]: Note: 1: 2205 2: 3: ActionText
Action 6:18:05: PublishProduct. Publishing product information
Action start 6:18:05: PublishProduct.
PublishProduct:
MSI (s) (18:14) [06:18:05:752]: Re-publishing product - installing new package with existing product code.
Action ended 6:18:05: PublishProduct. Return value 1.
MSI (s) (18:14) [06:18:05:752]: Skipping action: AlreadyUpdated (condition is false)
Is there any way to achieve this requirement? Am I doing something wrong?
Custom Action Complexity: First a word on custom actions and their complexity. Please read the first paragraphs here:
Why is it a good idea to limit the use of custom actions in my WiX / MSI setups?
Wrong Conditioning: This basically means your conditions are incorrect so the custom actions run in installation modes where they should not. There are many installation modes you should test in when you try to use complex conditions (or any condition for that matter): 1. fresh install, 2. repair, 3. modify, 4. self-repair, 5. patching, 6. uninstall, 7. major upgrade invoked uninstall, etc...
In your case some custom actions run on maintenance run as well as during fresh / first installation. This is a very common problem. The solution is either to eliminate the custom actions by improving the setup, or to improve conditions so they actually work in any installation mode. Obviously.
Condition Debugging: Conditions are hard to get right. I like to test them using message boxes. The bottom section here shows how you can do so: How to execute conditional custom action on install and modify only? - then you run the setup in different modes and look for the dialog boxes. When they show up the condition on the custom action is true.
Complex Conditions:
Here is an answer on why old custom actions are used for a new setup: Wix Tools update uses old custom actions.
There is also an answer listing some values for common properties in different installation modes: How to add a WiX custom action that happens only on uninstall (via MSI)?
Installshield has this PDF of common conditions (some of which are Installshield-specific): https://resources.flexera.com/web/pdf/archive/IS-CHS-Common-MSI-Conditions.pdf
Unexpected Behavior: A special note on the properties UPGRADINGPRODUCTCODE and WIX_UPGRADE_DETECTED. Please read this: Run Wix Custom action only during uninstall and not during Major upgrade - these quirks affect how many times a custom action runs during a major upgrade scenario. Some very surprising effects here for people. Use your message box debugging?
Links:
wix installer update process and confirmation dialog
Wix custom uninstallation action - how to run before msi removing files
Installing driver using cutomAction DriverPackageInstall in wix installer
WIX CustomAction conditions
Failed to get MSI property in UPGRADINGPRODUCTCODE, WIX_UPGRADE_DETECTED
Reboot on install, Don't reboot on uninstall

Unable to uninstall the application which is installed using wix installer

I have used wix installer to create an installer for my c# application.
Installation happened fine, but I am not able to uninstall the application. I see below the logs
MSI (s) (78:AC) [15:32:06:199]: Machine policy value 'Debug' is 0
MSI (s) (78:AC) [15:32:06:199]: ******* RunEngine:
******* Product: C:\wix\Installer\\bin\Debug\MyService-Debug-x86.msi
******* Action:
******* CommandLine: **********
MSI (s) (78:AC) [15:32:06:207]: Machine policy value 'DisableUserInstalls' is 0
MSI (s) (78:AC) [15:32:06:326]: Note: 1: 2203 2:
C:\Windows\Installer\inprogressinstallinfo.ipi 3: -2147287038
MSI (s) (78:AC) [15:32:06:327]: Machine policy value
'LimitSystemRestoreCheckpointing' is 0
MSI (s) (78:AC) [15:32:06:327]: Note: 1: 1717 2: My Service (32bit)
MSI (s) (78:AC) [15:32:06:327]: Note: 1: 2205 2: 3: Error
MSI (s) (78:AC) [15:32:06:327]: Note: 1: 2228 2: 3: Error 4: SELECT
`Message` FROM `Error` WHERE `Error` = 1717
MSI (s) (78:AC) [15:32:06:327]: Calling SRSetRestorePoint API.
dwRestorePtType: 1, dwEventType: 102, llSequenceNumber: 0, szDescription:
"Removed My Service (32bit)".
MSI (s) (78:AC) [15:32:06:330]: The System Restore service is disabled.
Returned status: 1058. GetLastError() returned: 1058
MSI (s) (78:AC) [15:32:06:332]: File will have security applied from OpCode.
MSI (s) (78:AC) [15:32:06:362]: SOFTWARE RESTRICTION POLICY: Verifying
package --> 'C:\wix\Installer\\bin\Debug\MyService-Debug-x86.msi' against
software restriction policy
MSI (s) (78:AC) [15:32:06:363]: Note: 1: 2262 2: DigitalSignature 3:
-2147287038
MSI (s) (78:AC) [15:32:06:363]: SOFTWARE RESTRICTION POLICY:
C:\wix\Installer\\bin\Debug\MyService-Debug-x86.msi is not digitally signed
MSI (s) (78:AC) [15:32:06:365]: SOFTWARE RESTRICTION POLICY:
C:\wix\Installer\\bin\Debug\MyService-Debug-x86.msi is permitted to run at
the 'unrestricted' authorization level.
MSI (s) (78:AC) [15:32:06:366]: MSCOREE not loaded loading copy from
system32
MSI (s) (78:AC) [15:32:06:374]: End dialog not enabled
MSI (s) (78:AC) [15:32:06:374]: Original package ==>
C:\wix\Installer\\bin\Debug\MyService-Debug-x86.msi
MSI (s) (78:AC) [15:32:06:374]: Package we're running from ==>
C:\Windows\Installer\152e2e.msi
While creating an installer, I never thought of digitally signing and all. Is it anything to do with signing? Totaly lost and need help
I have even tried with running uninstallation using the command line (admin mode) but no luck
msiexec.exe /x "C:\wix\Installer\\bin\Debug\MyService-Debug-x86.msi" /L*V "C:\work\wix.log"
it says
Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel.
I might have to rebuild the installer code before uninstalling. Is it possible that some "guid" has changed related to the installer? anything I have to check inside registry?
Updated the question with Wix Code
The issue started appearing after I added custom actions. The responsibility of custom action is to get parameters from the installer and update the appsettings.json. but this uninstallation issue not allowing me to continue implementation.
<Property Id="APPLICATIONLOG.PATHFORMAT" Secure="yes"/>
<Binary Id="CustomActionDLL"
SourceFile="..\..\Installer\CustomActions\bin\$(var.Configuration)\CustomAction.CA.dll" />
<CustomAction Id="SetPropertyAppLogPathId"
Property="SetPropertyAppLogPathProperty"
Value="APPLICATIONLOG.PATHFORMAT=[APPLICATIONLOG.PATHFORMAT]"/>
<CustomAction Id="SetPropertyAppLogPathProperty"
BinaryKey="CustomActionDLL"
DllEntry="UpdateConfigurationsAction"
Execute="deferred"
Return="check"
Impersonate="no" />
<InstallExecuteSequence>
<Custom Action="SetPropertyAppLogPathId" Before="SetPropertyAppLogPathProperty"><![CDATA[NOT Installed]]></Custom>
<Custom Action="SetPropertyAppLogPathProperty" After="InstallFiles"></Custom>
</InstallExecuteSequence>
My Custom Action c# code
public class CustomActions
{
public static string ApplicationPath { get; private set; }
[CustomAction]
public static ActionResult UpdateConfigurationsAction(Session session)
{
try
{
session.Log("Begin UpdateConfigurationsAction");
ApplicationPath = session.CustomActionData["APPLICATIONLOG.PATHFORMAT"];
session.Log("Application Log Path is: " + ApplicationPath);
return ActionResult.Success;
}
catch (Exception e)
{
session.Log("Error in UpdateConfigurationsAction " + e.Message);
return ActionResult.Failure;
}
}
}
Issue Resolved
The issue was with the custom action. After making proper InstallExecuteSequence it worked!
Will update in solution section
Cross-Link: How to clean out broken uninstalls.
Microsoft FixIt: Before trying anything else, perhaps try the Microsoft FixIt tool to see if you can get rid of any
dangling installations. If unsuccessful check further down for other
approaches.
Debugging & Logging: Next fix your custom action in the package based on custom action debugging (I recommend the Advanced Installer MSI CA debugging video, it is quick and a good "hello debugger" session) and gathering logging information.
Countermeasure: Finally, maybe add a property to suppress the custom action from running as described here ("Adding Condition" section).
This is the simplest
idea I know of to suppress custom actions from running on uninstall - you just set the property involved when needed to suppress the custom action if it crashes. >
I would use it for all my custom actions - in fact - so I can suppress them all (or
maybe one by one) - especially for uninstall scenarios where you run into "catch 22" situations (unable to install, upgrade or uninstall due to custom action bugs).
Dangling Installations: In order to detect all related, dangling installations (if any), you can use this approach: Unable to uninstall program from WiX created MSI (enumerate all products with the same upgrade code).
I will add these links for now in case you find that dangling version:
wix - custom action dialogbox on silent uninstall of application
I screwed up, how can I uninstall my program?
When trying to remove an MSI which crashes on uninstall, the central question is how many computers are involved? If it is just one, then hacking the cached MSI database may be acceptable, otherwise you should create a patch package to fix the uninstall sequence and then trigger uninstall the normal way.
Links:
Throwing in one more link: WIX does not uninstall older version. It is possible to have installations per-user or per-machine.

Wix upgrade goes into maintenance mode and never does upgrade

I am running Wix 3.11.1 and when trying to do an upgrade the upgrade goes into maintenance mode and leaves two entries in Add/Remove programs list.
A short version of Product.wxs has the following:
<Product Id="*" Name="Boo" Language="1033" Version="1.1.0.0" Manufacturer="Foo"
UpgradeCode="PUT-GUID-HERE">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine"/>
<MajorUpgrade AllowDowngrades="no" AllowSameVersionUpgrades="yes"
DowngradeErrorMessage="!(loc.NewerVersionInstalled)" />
Upgrade Code:
3F55CE54-8409-4918-9906-D8AD18794BFC
And the product and package code are:
1.0
Product Code FC49F622-02E6-40D9-ACD9-92BDD4AF5979
Package Code 6C49FAA1-5B11-4173-80A7-A7B3FA4313AE
1.1
Product Code 4871555F-F369-4159-9EF0-4BBDF07B6842
Package Code 3594D7C2-D5AC-4A41-A8C6-6E3D63C6ACA0
When I run the installer with logging I get the log information shown below.
When the upgrade code is the same and product and package codes are different, and the version is incremented in the first three digits I thought an upgrade should occur but is isn't. Also both versions are per-machine so that should not stop the removal of previous version. The log shows maintenance mode and never performs removal of previous version. I have an upgrade table in the msi and it shows the max value of 1.1 and WIX_UPGRADE_DETECTED as the action. Does anyone know what would cause this to enter maintenance mode rather do a major upgrade?
Log File
MSI (s) (68:9C) [15:04:38:423]: Doing action: RemoveExistingProducts
Action 15:04:38: RemoveExistingProducts. Removing applications
Action start 15:04:38: RemoveExistingProducts.
RemoveExistingProducts: Application: {FC49F622-02E6-40D9-ACD9-92BDD4AF5979}, Command line: UPGRADINGPRODUCTCODE={4871555F-F369-4159-9EF0-4BBDF07B6842} CLIENTPROCESSID=8344 CLIENTUILEVEL=0 MSICLIENTUSESEXTERNALUI=1 REMOVE=ALL
MSI (s) (68:BC) [15:04:38:423]: Resetting cached policy values
MSI (s) (68:BC) [15:04:38:423]: Machine policy value 'Debug' is 0
MSI (s) (68:BC) [15:04:38:423]: ******* RunEngine:
******* Product: {FC49F622-02E6-40D9-ACD9-92BDD4AF5979}
******* Action:
******* CommandLine: **********
MSI (s) (68:BC) [15:04:38:423]: Note: 1: 2203 2: C:\WINDOWS\Installer\inprogressinstallinfo.ipi 3: -2147287038
MSI (s) (68:BC) [15:04:38:423]: Machine policy value 'LimitSystemRestoreCheckpointing' is 0
MSI (s) (68:BC) [15:04:38:423]: Note: 1: 1717 2: Boo
MSI (s) (68:BC) [15:04:38:423]: Calling SRSetRestorePoint API. dwRestorePtType: 1, dwEventType: 102, llSequenceNumber: 0, szDescription: "Removed Boo".
MSI (s) (68:BC) [15:04:38:439]: The call to SRSetRestorePoint API succeeded. Returned status: 0, llSequenceNumber: 45.
MSI (s) (68:BC) [15:04:38:439]: End dialog not enabled
MSI (s) (68:BC) [15:04:38:439]: Original package ==> C:\WINDOWS\Installer\1179bb4.msi
MSI (s) (68:BC) [15:04:38:439]: Package we're running from ==> C:\WINDOWS\Installer\1179bb4.msi
MSI (s) (68:BC) [15:04:38:439]: APPCOMPAT: Uninstall Flags override found.
MSI (s) (68:BC) [15:04:38:439]: APPCOMPAT: Uninstall VersionNT override found.
MSI (s) (68:BC) [15:04:38:439]: APPCOMPAT: Uninstall ServicePackLevel override found.
MSI (s) (68:BC) [15:04:38:439]: APPCOMPAT: looking for appcompat database entry with ProductCode '{FC49F622-02E6-40D9-ACD9-92BDD4AF5979}'.
MSI (s) (68:BC) [15:04:38:439]: APPCOMPAT: no matching ProductCode found in database.
MSI (s) (68:BC) [15:04:38:439]: Machine policy value 'DisablePatch' is 0
MSI (s) (68:BC) [15:04:38:439]: Machine policy value 'AllowLockdownPatch' is 0
MSI (s) (68:BC) [15:04:38:439]: Machine policy value 'DisableLUAPatching' is 0
MSI (s) (68:BC) [15:04:38:439]: Machine policy value 'DisableFlyWeightPatching' is 0
MSI (s) (68:BC) [15:04:38:439]: APPCOMPAT: looking for appcompat database entry with ProductCode '{FC49F622-02E6-40D9-ACD9-92BDD4AF5979}'.
MSI (s) (68:BC) [15:04:38:439]: APPCOMPAT: no matching ProductCode found in database.
MSI (s) (68:BC) [15:04:38:439]: Transforms are not secure.
MSI (s) (68:BC) [15:04:38:439]: Command Line: UPGRADINGPRODUCTCODE={4871555F-F369-4159-9EF0-4BBDF07B6842} CLIENTPROCESSID=8344 CLIENTUILEVEL=0 MSICLIENTUSESEXTERNALUI=1 REMOVE=ALL
MSI (s) (68:BC) [15:04:38:439]: PROPERTY CHANGE: Adding PackageCode property. Its value is '{6C49FAA1-5B11-4173-80A7-A7B3FA4313AE}'.
MSI (s) (68:BC) [15:04:38:439]: Product Code passed to Engine.Initialize: '{FC49F622-02E6-40D9-ACD9-92BDD4AF5979}'
MSI (s) (68:BC) [15:04:38:439]: Product Code from property table before transforms: '{FC49F622-02E6-40D9-ACD9-92BDD4AF5979}'
MSI (s) (68:BC) [15:04:38:439]: Product Code from property table after transforms: '{FC49F622-02E6-40D9-ACD9-92BDD4AF5979}'
MSI (s) (68:BC) [15:04:38:439]: Product registered: entering maintenance mode
Update:
This is indeed a bundle install. I looked at the msi being the culprit because I thought that Wix bundle would use msiexec to perform the uninstall.
In our build we use the search term "0.0.0.0" for the version in the bundle and msi then we do a replace with the correct version, and at the end of the build we revert the Bundle.wxs and Product.wxs.
When the installer is being worked on the developer must comment out the revert, in the build file, in order to work on the files. When the developer is done they need to set the version back to "0.0.0.0". In one of the installer checkins someone had to forgotten to change back to "0.0.0.0".
I tried the msi for the two versions by themselves, and upgrade did indeed remove the entry for the original install. However the bundle upgrade still leaves second entry, even though the version is correct.
The log shows the upgrade was successful, installing the new product and removing the old one. The most likely explanation for the two entries in Programs&Features is that there is one for the actual MSI product and another from the WiX bootstrapper. You probably need to suppress the MSI one with ARPSYSTEMCOMPONENT=1 or with WiX bootstrapper support for suppressing the MSI's entry.
Short Version
Many Instances: I think there are many versions of your package installed in many instances "on top of each other" - some of which are hidden from Add / Remove Programs because of the ARPSYSTEMCOMPONENT=1 setting being specified in (some of) the package(s). One of the installed instances has the same product code as the package you are trying to install - this triggers maintenance mode - since the product code is already registered as installed.
Package Code Confusion?: It is also possible that you have installed two or more versions of the same MSI with identical package codes (as opposed to product codes). This always causes mysterious problems - for example the problem you are seeing with maintenance mode (identical package GUIDs mean two different MSI files will be treated as the same file by definition - since the GUIDs are the same - X-Files ensues as msiexec.exe goes behind your back and runs from the old, cached MSI and not your new MSI).
Bundle?: As Phil writes, it could be a WiX bundle problem as well. Maybe try the script towards the bottom first to get a full list of what is installed - hidden from view or not.
Detailed Version
Possible Cause: It seems you are setting ARPSYSTEMCOMPONENT = 1 which will hide the setup from Add / Remove Programs (ARP). As far as I can see there are numerous package and product codes in the log that do not match the ones you specify in your question. It seems you may have several older, test versions installed on the system that could also be hidden from ARP, but are still installed on the box. Not sure why you say the current version shows up in ARP though? With ARPSYSTEMCOMPONENT set it should not do so.
Virtuals: As the motto always goes: test on virtuals when you see weird problems - in order to determine if you have an unclean test environment. Virtuals testing is crucial for me, but I often do it too late.
MSDN: ARPSYSTEMCOMPONENT.
UPDATE:
Culprit Mechanism: When you set the product code to auto-generate, every build will be able to install without maintenance mode showing up - even without authoring the upgrade table at all. When you combine this with hiding from Add / Remove Programs you suddenly can't tell what prior versions were installed. Duplicates installed on top of each other could pile up as you do test installs.
Since you do seem to auto-generate the product code, you should never experience the current problem: maintenance mode. This leads me to suspect a package code duplication problem. Or a bundle problem, as suggested by Phil. I have too little experience with bundles. Could it be a bundle bug? Or even a WiX bug?
Manual Uninstall: Maybe try to use the VBScript you can find here to export a list of MSI product codes currently installed on the system (whether they are hidden or not): How can I find the product GUID of an installed MSI setup? (towards bottom, under "Alternate Tools, section 3".
UPDATE: please see the inlined and modified script version below instead.
Once you have the list, try to uninstall the undesired test packages using:
msiexec.exe /x [ProductCode]
keep going with uninstalls until you have a "clean box".
Major Upgrade with full version spread: Alternatively, you can set a wide version range (min / max version) for your upgrade table to see if you can uninstall all existing versions with a regular major upgrade. Frankly I have never taken the time to test uninstall of multiple prior versions using major upgrades, but as far as I know it should work. N.B!: I don't think this will work if you have package code duplication.
Uninstall Related Products: Another answer showing how to uninstall all products sharing the same upgrade code. Note the disclaimer that a reboot could be triggered automatically when run in silent mode: Powershell: Uninstall application by UpgradeCode.
Uninstall By Product Name: And less sensible, but I will just add a link for safekeeping. Here is how you can uninstall an MSI package by product name: Is there an alternative to GUID when using msiexec to uninstall an application?
List All Installed MSI Products
UPDATE: Come to think of it, let me inline the linked script above with a couple of additions - this adds headers and publisher and package code to the export. This script should show all installed packages, including those hidden from Add / Remove Programs (if you also need Upgrade Code, then this is a little more complicated for technical reasons, here is a description of how it can be done in a clunky way - that link in turn has further links for how to retrieve upgrade codes with Powershell):
' Retrieve all ProductCodes (with ProductName and ProductVersion)
Set fso = CreateObject("Scripting.FileSystemObject")
Set output = fso.CreateTextFile("msiinfo.csv", True, True)
Set installer = CreateObject("WindowsInstaller.Installer")
output.writeline ("Product Code,Product Name,Product Version,Package Code, Publisher")
On Error Resume Next ' we ignore all errors
For Each product In installer.ProductsEx("", "", 7)
productcode = product.ProductCode
name = product.InstallProperty("ProductName")
version=product.InstallProperty("VersionString")
packagecode=product.InstallProperty("PackageCode")
publisher=product.InstallProperty("Publisher")
output.writeline (productcode & ", " & name & ", " & version & ", " & packagecode & ", " & publisher)
Next
output.Close
Usage:
Copy the script and paste into a *.vbs file on your desktop, and try to run it by double clicking. Your desktop must be writable for you, or you can use any other writable location.
The output file is created in the folder where you run the script from (folder must be writable). The output file is called msiinfo.csv.
Double click the file to open in a spreadsheet application, select comma as delimiter on import - OR - just open the file in Notepad or any text viewer.
The content in the spreadsheet should be formatted in columns, if not do a manual file open and import the file selecting comma as the delimiter for the CSV file (comma separated values). Doing so will yield full spreadsheet capabilities, such as sorting by column - for example Publisher - so you see all your setups next to each other.

Wix MSI fails when setting permissions on network path (util:PermissionEx)

I have an MSI that works perfectly when installing locally. If the data path is set to a network location, it fails.
Relevant LOG:
MSI (s) (BC:4C) [17:01:57:322]: Executing op: ActionStart(Name=ExecSecureObjects_64,,)
MSI (s) (BC:4C) [17:01:57:322]: Executing op: CustomActionSchedule(Action=ExecSecureObjects_64,ActionType=3073,Source=BinaryData,Target=ExecSecureObjects,CustomActionData=\\ravel\TeamData\lrieger\Tim2015Pre_Data\CreateFolderEveryone-1073741824C:\ProgramData\Nemetschek Engineering\TIM 2015.0.0.477590057-pre\CreateFolderEveryone-1073741824)
MSI (s) (BC:78) [17:01:57:324]: Invoking remote custom action. DLL: C:\Windows\Installer\MSIAEDE.tmp, Entrypoint: ExecSecureObjects
MSI (s) (BC:A8) [17:01:57:324]: Generating random cookie.
MSI (s) (BC:A8) [17:01:57:325]: Created Custom Action Server with PID 4488 (0x1188).
MSI (s) (BC:60) [17:01:57:335]: Running as a service.
MSI (s) (BC:60) [17:01:57:337]: Hello, I'm your 64bit Elevated custom action server.
ExecSecureObjects: Error 0x80070005: failed to get security info for object: \\ravel\TeamData\lrieger\Tim2015Pre_Data\
CustomAction ExecSecureObjects_64 returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
MSI (s) (BC:4C) [17:01:57:393]: Note: 1: 2265 2: 3: -2147287035
MSI (s) (BC:4C) [17:01:57:393]: User policy value 'DisableRollback' is 0
MSI (s) (BC:4C) [17:01:57:393]: Machine policy value 'DisableRollback' is 0
Action ended 17:01:57: InstallExecute. Return value 3.
WIX Code:
<Component Directory="DATA_DIRECTORY">
<RegistryValue Root="HKLM" Key="$(var.RegRoot)\Setup" Name="TIM_DATA_DIRECTORY" Value="0xff" Type="string" />
<CreateFolder>
<util:PermissionEx User="Everyone" GenericRead="yes" GenericWrite="yes" Domain="[LOGONDOMAIN]" />
</CreateFolder>
</Component>
Without the util:PermissionEx it works on the network share, but setting these permissions is a requirement, at least if the target directory is local.
Q: Is it possible to set permissions on a network location with wix/msi?
If Not, how can I detect that it is a network directory?
Or is there, in MSI, any way to mark a component as allowed to fail?
If it is not possible to do any of the above, I will probably need to write a custom action that tries to set the permissions but suppresses any failures...
Briefly, I don't think it's possible. The issue is that elevated custom actions run with the system account, and that account doesn't have any network privileges. That WiX utils code is already a custom action that's supplied as a helper for a common task, so writing your own custom action isn't going to help. If you run the CA not impersonated it won't run elevated (unless you elevate the entire MSI install at launch time) so that's not likely to help either. You need an elevated user app to do this for the network share, maybe run at first use of the app itself. This might help:
http://wixtoolset.org/documentation/manual/v3/howtos/ui_and_localization/run_program_after_install.html
I would assume it's a network share if it starts with \. A drive letter won't work with the CA anyway because drive letters are a user profile mapping (not a system mapping), so the system account won't know of them. In .Net, FileSystem.GetDriveInfo would help.

WiX patching not updating files correctly

My "admin-image" style WiX test patches are failing to update the existing installation correctly. When using msiexec /lx, I get the following information related to patching "fi_executable.exe":
MSI (s) (88:E0) [12:32:41:716]: Baseline: Patch {E244BAC8-7E62-4406-889B-4B67A4EA7369} modified fi_executable.exe with full-file update.
MSI (s) (88:E0) [12:32:41:716]: Baseline: First patch for fi_executable.exe, saving native info.
MSI (s) (88:E0) [12:32:41:716]: Baseline: fi_executable.exe version for baseline at patch Native: 6.0.5803.11, 1033, 53840.
...
MSI (s) (88:E0) [12:32:41:716]: Baseline: fi_executable.exe version for baseline at patch {E244BAC8-7E62-4406-889B-4B67A4EA7369}: 6.0.5830.99, 1033, 47104.
...
MSI (s) (88:E0) [12:32:41:763]: {E244BAC8-7E62-4406-889B-4B67A4EA7369} File: fi_executable.exe ValData: 6.0.5830.99 1033 47104
...
MSI (s) (88:E0) [12:32:41:763]: Native File: fi_executable.exe ValData: 6.0.5803.11 1033 53840
...
MSI (s) (88:E0) [12:32:42:543]: The file represented by File table key 'fi_executable.exe' has no eligible binary patches
So even though the version number is changing, and Windows Installer notes that the patch modifies the file, Windows Installer is not recognizing that there should be an update to the executable.
Why?
Have you tested the upgrade with complete MSI files first before trying with the patch? Patching is just a delivery mechanism for upgrades packaged in a more compressed fashion, if the full MSI upgrade doesn't work, neither will the patch.
Try to install your patch with this command line:
msiexec /p patch.msp /qb REINSTALL=ALL REINSTALLMODE=omusa
Without these additional parameters, my patch failed to install correctly: it didn't update any files.