Get-WmiObject : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) for remote computer

Gautam Sharma 1 Reputation point
2022-12-23T15:26:35.123+00:00

WMIObject: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) error for the remote computer.

My lab environment:

  • Domain controler on Hyper-V
  • Windows 10 domain join on Hyper-V
  • Both DC and Windows 10 are on the same Hyper-V and in the same subnet
  • The firewall is disabled on both systems.
  • Hyper-V is standalone and hosted on Azure Cloud.

Running the following PS:

Get-WmiObject -query "SELECT * FROM Win32_OperatingSystem" -ComputerName DESKTOP-QN5E1DS.euclab.in

Troubleshooting already performed but no luck:

  • Open the PS with elevated permissions
  • provided credentials with the above PS
  • Expressly added Domain Admin group to the "Administrators" and "Remote Management Users" groups on the remote machine.
  • From DC able to connect a remote computer using "Computer Management" and able to access System Tools, Storage & services. However, getting an error "Failed to connect to \DESKTOP-QN5E1DS.euclab.in because "Win32: Access is denied." while connecting using "WMI Control Properties".
  • File share \DESKTOP-QN5E1DS.euclab.in is accessing without any error.

DCOM permission

Open Dcomcnfg
Expand Component Service -> Computers -> My computer
Go to the properties of My Computer
Select the COM Security Tab
Click on "Edit Limits" under Access Permissions, and ensure "Everyone" user group has "Local Access" and "Remote Access" permission.
Click on the "Edit Limit" for the launch and activation permissions, and ensure "Everyone" user group has "Local Activation" and "Local Launch" permission.
Highlight "DCOM Config" node, and right click "Windows Management and Instruments", and click Properties.
<Please add the steps to check Launch and Activation Permissions, Access Permissions, Configuration Permissions based on the default of Windows Server 2008>

Permission for the user to the WMI namespace

Open WMImgmt.msc
Go to the Properties of WMI Control
Go to the Security Tab
Select "Root" and open "Security"
Ensure "Authenticated Users" has "Execute Methods", "Provider Right" and "Enable Account" right; ensure Administrators have all permission.

Verify WMI Impersonation Rights

Click Start, click Run, type gpedit.msc, and then click OK.
Under Local Computer Policy, expand Computer Configuration, and then expand Windows Settings.
Expand Security Settings, expand Local Policies, and then click User Rights Assignment.
Verify that the SERVICE account is specifically granted Impersonate a client after authentication rights.

Detailed error:

Get-WmiObject -query "SELECT * FROM Win32_OperatingSystem" -ComputerName DESKTOP-QN5E1DS.euclab.in -Credential $cred -Verbose

Get-WmiObject : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
At line:1 char:1

  • Get-WmiObject -query "SELECT * FROM Win32_OperatingSystem" -ComputerN ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • CategoryInfo : NotSpecified: (:) [Get-WmiObject], UnauthorizedAccessException
  • FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

Does anyone have any other ideas? or was there something I overlooked?

Windows Server Management
Windows Server Management
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Management: The act or process of organizing, handling, directing or controlling something.
440 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,546 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Rich Matheisen 46,806 Reputation points
    2022-12-23T16:52:35.777+00:00

    Have you checked that "Enable Distributed COM on this computer" is enabled?

    Have you tried using Get-CIMObject (using WinRM) instead of Get-WMIObject? how-to-confirm-winrm-and-remote-scripting


  2. Gupta, Nishant 0 Reputation points
    2023-09-05T11:30:01.3+00:00

    Look in the namespace under WMI permisssion and make sure you have selected -

    the namespace and subnamespace

    For the account you have giving permission

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.