I am trying to uninstall a program with a C# application and everything works except the program is still listed in the Control Panel Programs & Features.
It also does this when I uninstall from the command line using wmic.
The program is uninstalled, but I still have to actually click the name in control panel programs & features for a window to pop up and tell me it has uninstalled. After that, it is gone for good. How can I bypass having to go into control panel to completely remove it. I need it to be uninstalled and not listed in control panel.
This is my code to uninstall which appears to be correct:
string programName = "myProgram";
ManagementObjectSearcher mos = new ManagementObjectSearcher("SELECT * FROM Win32_Product");
foreach (ManagementObject mo in mos)
{
if (mo["name"].ToString().Contains(programName))
{
mo.InvokeMethod("Uninstall", null);
MessageBox.Show(mo["name"].ToString() + " uninstalled");
}
}