Uninstall through WMI

  • Thread starter Thread starter Dan Pavel
  • Start date Start date
D

Dan Pavel

Hi,

I need to build an small application to uninstall an application,
remotely, from the computers in my network. How I can do this through
WMI. It is not an application installed by MSI.
I use this to gather the UninstallString:

keyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" +
subKey;
keyName = "DisplayName";
keyString = "UninstallString";
ManagementBaseObject outParam =
wmiRegistry.InvokeMethod("GetStringValue", inParam, null);
if ((uint)outParam["ReturnValue"] == 0)
{
listBox1.Items.Add(Convert.ToString(outParam["sValue"]));
}

but after I have this uninstall string, I don't know how to use it to
start the uninstallation.
Please help
Thank you
 
Back
Top