Windows

How to fix Get-CimInstance Access PermissionDenied

cimInstance-wmi

The Get-CimInstance cmdlet gets the Common Information Model (CIM) instances of a class from a CIM server. You can specify either the class name or a query for this cmdlet. This cmdlet returns one or more CIM instance objects representing a snapshot of the CIM instances present on the CIM server. A CIM session is a client-side object representing a connection to a local computer or a remote computer. The CIM session contains information about the connection, such as ComputerName, the protocol used, or various identifiers. As you are aware, the Get-WmiObject cmdlet has been superseded with the Get-CimInstance cmdlets as discussed in this guide “How to get a list of installed applications using PowerShell in Windows“, and Windows Management Instrumentation: WMI Commands. In this article, you would learn how to fix Get-CimInstance Access PermissionDenied.

Note: The CIM is an extensible, object-oriented data model that contains information about different parts of an enterprise. The CIM is a cross-platform standard maintained by the Distributed Management Task Force (DMTF). Here are some related guides: How to get the list of installed programs locally or remote computer in Windows. How to get a list of installed applications using PowerShell in Windows. And lastly, how to delete an Instance (AssignedAccess) when applied via MDM WMI bridge Provider.

From the image below, I am running the Get-CimInstance command to query a remote device and it failed. But on my local PC with administrative rights, I am able to get the information for this specific PC. I will be showing you this very shortly, and why this is so. Here is a similar error “WinRM cannot complete the operation, verify that the specified computer name is valid, that the computer is accessible“.

image-43

Why was the Get-CimInstance Access Denied Prompted?

This error was prompted because, as you can see from the command below, I was remotely querying a device that I do not have administrative rights over using my regular (standard) Windows account. Below is the cmdlet to query the Windows-based operating system. Knowing your environment is paramount to resolving this issue.

PS C:\Windows\System32> Get-CimInstance Win32_OperatingSystem -computer TechDAPc1

Launch PowerShell with Administrative Rights

To fix this issue, you will need to run PowerShell in the context of a different user with an account that has an administrative right to manage the device.

Step 1: To do this, please launch the Command Prompt by right-clicking and selecting “Run as different user“. You may need to hold the Shift button while right-clicking as the case may be!

image-44

This step is optional: You can do the same for PowerShell as shown below

image-45

Step 2: – Query the Remote Device

You can also use the Windows Terminal as the default shell opens in Windows PowerShell. Alternatively, you can enter PowerShell in the Command Prompt terminal as shown below to switch to PowerShell. Then run the cmdlet below to query the remote device. Under the column “Registered User”,

PS C:\Windows\System32> Get-CimInstance Win32_OperatingSystem -computer TechDAPc1
image-46

Note: The difference between Get-WMIObject and Get-CimInstance cmdlets is the protocols and security in use when accessing a remote computer. Once they get to the remote computer and authenticate, WMI and CIM access the same data. Learn more from this guide “How to get the list of installed programs locally and on a remote computer in Windows“. Kindly refer to these related guides: How to Locate Your PC’s BIOS Serial Number and System Information on Windows 11, and how to Enable or Disable WMI Traffic at Command Prompt Using WMI Rule.

As discussed previously, running the command locally as an administrator will not prompt this error because I am a member of the local administrator group on this PC. Below is the output when run as a standard user having the local administrators right, and will display the output for the Win32_operatingsystem data store.

image-47

I hope you found this blog post helpful. Now, you have learned how to fix the “Get-CimInstance Access PermissionDenied” issue. If you have any questions, please let me know in the comment session.

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x