cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
AL1381
Level 3

Uninstall another msi packages

Hi,
I'm working on a setup.exe which shall uninstall some older versions of different programs before starting the actual installation process.
I've implemented this with some CAs in the "Installation/User Interface" sequence, and it worked fine.

The problem is that the setup.exe shall be executed in silent mode.
I didn't manage to place the CAs for uninstall in the "Installation/Execute" sequence in a way, that they are properly executed.

Maybe you can help me?
Many Thanks
Labels (1)
0 Kudos
(3) Replies
PlinyElder
Level 7

Why CAN'T you place them in the "Installation/Execute" sequence? That would solve the problem of them running while in silent mode..
0 Kudos
AL1381
Level 3

The initial problem, was that the execution of the CA was stopped with the error message 1618: "Another installation is already in progress"

After changing the Return Processing to "Asynchronus (no wait)" the CAs are execute.
Now I have to check, if the asynchronus execution causes other problems during the subsequent install process.

Thanks for your question and your though-provoking impulse.
0 Kudos
PlinyElder
Level 7

Ive done a custom MSI uninstallation of multiple packages with a Custom Managed Code action. I use c# to run a WMI query for certain package names, then run their uninstall command stored in the registry.

[CODE]
string searchString = "SELECT * FROM Win32_Product WHERE Name LIKE 'my-app';
ManagementObjectSearcher mos = new ManagementObjectSearcher(searchString);

foreach (ManagementObject mo in mos.Get())
{
// Will return Name, IdentifyingNumber and Version
try
{
if (mo["Name"].ToString().Contains("my-app"))
{
//object arp = mo.InvokeMethod("Uninstall", null);
Process process = new Process();
process.StartInfo.FileName = "msiexec.exe";
process.StartInfo.Arguments = "/X" + mo["IdentifyingNumber"].ToString() + " /q";
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.CreateNoWindow = false;
process.Start();
process.WaitForExit();
}
}
catch (Exception ex)
{
//this program may not have a name property, so an exception will be thrown
//handle your exception here
}
}
[/CODE]
0 Kudos