How to Configure Windows Server 2016 Windows Management Instrumentation
Windows Management Instrumentation (WMI) is the infrastructure for management data and operations on Windows operating systems. On Windows Server 2016, WMI provides a standardized way for scripts, applications, and management tools to query and control virtually every aspect of the server — from hardware inventory and performance counters to service configuration and event subscriptions. Understanding how to configure WMI correctly is fundamental to any serious Windows server administration practice.
This tutorial covers WMI architecture, enabling and securing WMI access, querying data with PowerShell and WMIC, setting up remote WMI connections, and troubleshooting common WMI issues on Windows Server 2016.
WMI Architecture Overview
WMI is organized into namespaces, which act like databases grouping related classes. The most commonly used namespace is rootcimv2, which contains classes for operating system objects such as processes, services, disks, and network adapters. Other important namespaces include rootdefault for registry access, rootwmi for driver-level data, and rootvirtualizationv2 for Hyper-V management.
WMI classes follow the Common Information Model (CIM) standard, which means PowerShell cmdlets prefixed with Get-Cim work against the same underlying data as WMI cmdlets, but using the modern WS-Management protocol instead of the legacy DCOM transport.
Step 1: Verify the WMI Service
The Windows Management Instrumentation service must be running. Check and start it if necessary:
Get-Service -Name Winmgmt
Start-Service -Name Winmgmt
Set-Service -Name Winmgmt -StartupType Automatic
Step 2: Query WMI Data with PowerShell
Use Get-CimInstance to query WMI classes. Retrieve basic operating system information:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object Caption, Version, OSArchitecture, LastBootUpTime
List all running services:
Get-CimInstance -ClassName Win32_Service | Where-Object { $_.State -eq 'Running' } | Select-Object Name, DisplayName, StartMode
Query disk information:
Get-CimInstance -ClassName Win32_LogicalDisk | Select-Object DeviceID, Size, FreeSpace, DriveType
Retrieve CPU information:
Get-CimInstance -ClassName Win32_Processor | Select-Object Name, NumberOfCores, NumberOfLogicalProcessors, MaxClockSpeed
Step 3: Enable Remote WMI Access
Remote WMI queries require WMI to be accessible over the network and the Windows Firewall to permit the traffic. Enable remote WMI access using the built-in firewall exception group:
netsh advfirewall firewall set rule group="Windows Management Instrumentation (WMI)" new enable=yes
You can also enable the WMI firewall rules through PowerShell:
Enable-NetFirewallRule -DisplayGroup "Windows Management Instrumentation (WMI)"
Step 4: Configure WMI Namespace Security
WMI namespace security controls which users can read or write WMI data. Open the WMI Control console:
wmimgmt.msc
Right-click WMI Control (Local) and select Properties. On the Security tab, navigate to the namespace you want to modify (typically rootcimv2), click Security, and add the required users or groups with appropriate permissions. Standard users typically need Execute Methods, Enable Account, and Remote Enable permissions for read access.
To grant a non-administrator remote WMI access via PowerShell, use the Set-WMINamespaceSecurity script available in the PowerShell community, or manually edit the namespace security descriptor using WBEMTEST.
Step 5: Query Remote WMI
Once the firewall and permissions are configured, query a remote machine:
Get-CimInstance -ClassName Win32_ComputerSystem -ComputerName Server02
For environments that use older DCOM-based WMI connections, create a CimSession with DCOM options:
$SessionOptions = New-CimSessionOption -Protocol Dcom
$Session = New-CimSession -ComputerName Server02 -SessionOption $SessionOptions
Get-CimInstance -ClassName Win32_OperatingSystem -CimSession $Session
Step 6: WMI Event Subscriptions
WMI supports permanent event subscriptions that persist across reboots. The following creates a subscription that logs an entry whenever a new process starts:
$FilterArgs = @{
Name = 'ProcessStartFilter'
EventNameSpace = 'rootcimv2'
QueryLanguage = 'WQL'
Query = "SELECT * FROM Win32_ProcessStartTrace"
}
$Filter = Set-WMIInstance -Class __EventFilter -Namespace rootsubscription -Arguments $FilterArgs
Step 7: Rebuild the WMI Repository
If WMI becomes corrupted, queries fail with errors like 0x80041003. Rebuild the repository by stopping the service, removing the cache, and restarting:
net stop winmgmt /y
winmgmt /resetrepository
net start winmgmt
After rebuilding, verify that basic queries work before putting the server back into production. Rebuilding discards custom WMI class registrations, so applications that extend WMI may need to be reinstalled or reconfigured.
Troubleshooting WMI
Check WMI activity and errors in the event log:
Get-WinEvent -LogName "Microsoft-Windows-WMI-Activity/Operational" -MaxEvents 30
Use WBEMTEST to manually connect to namespaces and execute queries interactively:
wbemtest
WMI on Windows Server 2016 underpins a vast range of management operations. Keeping the service healthy, securing namespace permissions, and enabling appropriate network access ensures that your monitoring tools, automation scripts, and management platforms can reliably collect data and control server behavior.