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.
- Add the user to the Performance Monitor Users group, locally in
compmgmt.mscor through Group Policy. - Open
wmimgmt.msc, open the properties of WMI Control and go to the Security tab. Select theRoot\CIMV2namespace, click Security, add Performance Monitor Users and enable Enable Account and Remote Enable. - 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. - 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
- The source contained service account names, passwords and internal server names. They were removed and must never be published.
- The source referred to an internal script to set namespace security. It is not reproduced here; step 2 describes the same change in the console.
- The source also covered installing the
wmicclient on CentOS from a third-party RPM. That part was left out. - Sources: ITProToday, easier way to view incoming WMI queries and ServerFault, permissions a user needs for remote WMI access.