LLI Wiki — My Digital Knowledge Base

Enable WMI activity tracing and grant remote WMI access

Enable the WMI-Activity trace log, read ExecQuery entries and let a non-administrator account query WMI remotely.

Windows can log the WMI queries it receives in the Microsoft-Windows-WMI-Activity/Trace event log. This article shows how to enable that log, read the ExecQuery entries, and let a non-administrator account query WMI remotely.

Enable the WMI tracing log

Run in an elevated command prompt:

wevtutil sl Microsoft-Windows-WMI-Activity/Trace /e:true

Read the WMI queries

wevtutil qe Microsoft-Windows-WMI-Activity/Trace /q:"*[System[(Level=4 or Level=0) and (EventID=1)]]" | findstr /i execquery

To generate an entry to check, run a test query:

Get-WmiObject -Query "SELECT * FROM Win32_OperatingSystem"
Get-WmiObject -Query "SELECT * FROM Win32_OperatingSystem" -ComputerName SERVER01

Give a non-administrator account remote WMI access

The steps below let a user query WMI remotely without being a local administrator.

  1. Add the user to the Performance Monitor Users group, locally in compmgmt.msc or through Group Policy.
  2. Open wmimgmt.msc, open the properties of WMI Control and go to the Security tab. Select the Root\CIMV2 namespace, click Security, add Performance Monitor Users and enable Enable Account and Remote Enable.
  3. Run dcomcnfg. Under Component Services > Computers > My Computer, open the properties, go to the COM Security tab and click Edit Limits for both Access Permissions and Launch and Activation Permissions. Add Performance Monitor Users and allow Remote Access, Remote Launch and Remote Activation.
  4. Under Component Services > Computers > My Computer > DCOM Config, select Windows Management Instrumentation and give Remote Launch and Remote Activation to Performance Monitor Users.

Steps 3 and 4 can be replaced by adding the user to the Distributed COM Users group, which the source reports as tested on Windows Server 2012 R2. To grant access to all namespaces, apply step 2 at the Root level and propagate the permissions to the sub-namespaces from the Advanced dialog.

Notes

Mastodon LLIMastodon SocialFosstodon