none
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) RRS feed

  • Question

  • Hi,

    I am getting "Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))" when i tried to 'Invoke' a WMI Method (Method to change the HyperV Virtual machine name)

    The method works fine when i tried invoking from a Console application.

    I exposed the same method as a WCF service and hosted it in IIS 7. Here if i try to invoke the same service method it gives me the Access Denied message.

    Any help is appreciated.

    Regards,

    Hari

    Monday, November 28, 2011 11:43 AM

Answers

  • All WMI commands must execute in a security context that has permissions on the machine the WMI is directed at.

    If your IIS hosted application runs under "Local System" or "Network Service" it has no permissions beyond the server where it executes (no permissions on the remote Hyper-V server) and will be denied access.

    You can go into the WMI and WinRM event logs and turn on full tracing, execute your command and then you can capture your denied access.  These diagnostic logs automatically disable once they reach a certain size as they can quickly fill a machine.

    To have permissions on the Hyper-V Server you will need creadentials of an account that has administrative rights on the Hyper-V Server - this would be the first try just to get it working.  Best practice would be to use an account that is tightened down to only execute those taskss required.

     


    Brian Ehlert (hopefully you have found this useful) http://ITProctology.blogspot.com
    Learn. Apply. Repeat.
    Monday, November 28, 2011 3:39 PM
    Moderator

All replies

  • Hi, "Access denied" errors are generally caused by insufficient permissions. - Do you have enough permissions to execute the command? - Are you executing your request locally or remotely ? - Try to execute your prompt as an Administrator ? - Make a look to your Security Event Log, try to report us failure events that occurs when access denied message appears ?


    Regards, Samir Farhat Infrastructure Consultant
    Monday, November 28, 2011 12:08 PM
  • Samir thanks for your replay.

    I am executing the the command remotely. I have hosted the .net API in IIS 7 (on a Windows 7 machine). My Hyper V server is a Win 2008 server machine.

    I checked the event, there is no events occured related to this.

    Regards,

    Hari

    Monday, November 28, 2011 1:12 PM
  • All WMI commands must execute in a security context that has permissions on the machine the WMI is directed at.

    If your IIS hosted application runs under "Local System" or "Network Service" it has no permissions beyond the server where it executes (no permissions on the remote Hyper-V server) and will be denied access.

    You can go into the WMI and WinRM event logs and turn on full tracing, execute your command and then you can capture your denied access.  These diagnostic logs automatically disable once they reach a certain size as they can quickly fill a machine.

    To have permissions on the Hyper-V Server you will need creadentials of an account that has administrative rights on the Hyper-V Server - this would be the first try just to get it working.  Best practice would be to use an account that is tightened down to only execute those taskss required.

     


    Brian Ehlert (hopefully you have found this useful) http://ITProctology.blogspot.com
    Learn. Apply. Repeat.
    Monday, November 28, 2011 3:39 PM
    Moderator