Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. COM
  4. Access Is Denied Error

Access Is Denied Error

Scheduled Pinned Locked Moved COM
helpcsharpdatabasesysadmin
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Captain Trips
    wrote on last edited by
    #1

    Hi, I'm trying to run WMI queries against a server in a C# application. I'm pretty sure my code and provided DB/User/Password is ok. On the connect command the following error is raised: "Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))" ConnectionOptions oConn = new ConnectionOptions(); oConn.Username = strUsername; oConn.Password = strPassword; oConn.Impersonation = ImpersonationLevel.Impersonate; System.Management.ManagementScope oMs = new System.Management.ManagementScope("\\\\domain\\servername\\root\\cimv2", oConn); oMs.Connect(); I'm fairly sure its a privileges problem. I'm using a username and password that has admin privileges on the server. I've allowed remote administration and granted DCOM remote launch permissions. Any idea would be much appreciated! thanks!

    L 1 Reply Last reply
    0
    • C Captain Trips

      Hi, I'm trying to run WMI queries against a server in a C# application. I'm pretty sure my code and provided DB/User/Password is ok. On the connect command the following error is raised: "Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))" ConnectionOptions oConn = new ConnectionOptions(); oConn.Username = strUsername; oConn.Password = strPassword; oConn.Impersonation = ImpersonationLevel.Impersonate; System.Management.ManagementScope oMs = new System.Management.ManagementScope("\\\\domain\\servername\\root\\cimv2", oConn); oMs.Connect(); I'm fairly sure its a privileges problem. I'm using a username and password that has admin privileges on the server. I've allowed remote administration and granted DCOM remote launch permissions. Any idea would be much appreciated! thanks!

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Captain Trips wrote:

      I'm using a username and password that has admin privileges on the server.

      As you said you are using Admin privileges to connect, try reseting your WMI repository (please ensure you have backedup your existing repository before you reset it) if that helps. Does following link help? http://www.microsoft.com/technet/scriptcenter/topics/help/wmi.mspx[^] http://msmvps.com/blogs/lduncan/pages/20217.aspx[^] http://msdn2.microsoft.com/en-us/library/aa394525.aspx[^]

      Sohail

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups