Question

I am trying to uninstall programs in C# with the REBOOT=ReallySuppress command line argument, but a Windows process monitor (API Monitor by Rohitab) shows that my desired command line args are not actually being passed to msiexec.exe. Is there a flaw in my code?

public static List<ManagementObject> programs;       

public void Uninstall(int index)
{
    object[] args = {"REBOOT=ReallySuppress", "REMOVE=ALL"};
    programs[index].InvokeMethod("Uninstall", args);
}

...

The list of programs is initialized elsewhere in the code and is working properly. API Monitor shows that the msiexec.exe process was started with the following parameters:

"C:\Windows\SysWOW64\\msiexec.exe" /i "C:\Users\Joel Denning\AppData\LocalLow\Sun\Java\jre1.7.0_45.msi" /qn METHOD=joff

which does not have the REBOOT=ReallySuppress or REMOVE=ALL arguments that I passed in.

Was it helpful?

Solution

The underlaying Type is Win32_Product. The Method uninstall of this class has no arguments. http://msdn.microsoft.com/en-us/library/aa393941(v=vs.85).aspx

So your code seems syntactically ok.

See How to uninstall program without rebooting

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top