title: Using WMI to uninstall programs
body: <p>I want to uninstall a program using WMI, but I get this error : "Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))". Installing it worked without any problems, using the same ConnectionOptions. 
  Is there any possibility that the Administrator user has rigths to install software, but not to uninstall? If so, how can I edit them?</p>
  
  <pre><code>Main()
  {
          ConnectionOptions oConn = new ConnectionOptions();
          oConn.Impersonation = ImpersonationLevel.Impersonate;
          oConn.EnablePrivileges = true;
          oConn.Username = "Administrator";
          oConn.Password = "password";
  
          System.Management.ManagementScope oMs = 
              new System.Management.ManagementScope("\\\\192.168.14.128\\root\\cimv2", oConn);
  
          Uninstall(oMs, "\\\\192.168.14.128\\root\\cimv2:Win32_Product.IdentifyingNumber=    \"{926C96FB-9D0A-4504-8000-C6D3A4A3118E}\",Name=\"Java DB 10.4.2.1\",Version=\"10.4.2.1\"");
  
  }
  
      static void Uninstall(ManagementScope oMs, string path)
      {
          if (!oMs.IsConnected) oMs.Connect();
          ManagementObject product = new ManagementObject(path);
  
          if ((product != null) &amp;&amp; (product.Path.ClassName ==
          "Win32_Product"))
          {
              object result = product.InvokeMethod("Uninstall", null); //here is where I get the error
              Console.WriteLine("The Uninstall method result is {0}",
              result.ToString());
          }
     }
  </code></pre>
  
  <p>Thank You!</p>