title: Access denied when attempting remote WMI calls from a service
body: <p>I have a C# application which connects via WMI to many remote systems, both in a domain and standalone.  The program provides wmi with credentials and uses impersonation.  When run manually (from a console), it connects fine and all is well.  However, when this same .exe is called from a service (running as local user), it always gets 0x80070005 (E_ACCESSDENIED) when it calls Connect() on the ManagementScope.</p>
  
  <p>I've searched quite a bit and found many seemingly useful articles on similar topics, but none work.
  <a href="http://blogs.msdn.com/b/wmi/archive/2009/03/13/let-s-troubleshoot-wmi-part-1-remoting-and-security.aspx" rel="nofollow">This one</a> and his [subsequent post][2] on MS's site is very similar, except my failure happens at connect, not when trying to run a query, so it feels like a local system permission issue.</p>
  
  <p>I have messed with DCOM permissions, WMI remoting permissions, impersonation options, policy options, windows firewall, among other things, all with no results.  Is there anyone out there who can help?</p>
  
  <p>Edit: With a little more digging I found <a href="http://blogs.msdn.com/b/wmi/archive/2009/03/13/let-s-troubleshoot-wmi-part-1-remoting-and-security.aspx" rel="nofollow">this small page</a> from MS, which really points to my error (0x80070005) being a DCOM problem which happens during connection, and not specifically a WMI error.  The causes they give are 1. Credential failure, or 2. DCOM launch/Remote activation permissions.  Since my program works when run manually using the same credentials, I have to assume its a DCOM issue.  I have set Remote/Local Activation &amp; launch to allow for SYSTEM, LOCAL SERVICE, INTERACTIVE and Administrators, but it still fails.  Since the service is running as Local System, I assume these settings should suffice.</p>