FolderRisk: Caution
Logs C:\Windows\System32\wbem\Logs
WMI text logs (wbemcore.log, mofcomp.log, etc.): errors from the service, providers and MOF compilations.
What it’s for
wbem\Logs receives the text logs of the WMI infrastructure. WMI now traces its activity through ETW rather than text files, but the service, the MOF compiler and some providers still write their own logs here. It is the place to look when a WMI provider stops answering or a MOF file will not compile.
What it contains
wbemcore.log: log of the WMI service core.mofcomp.log: results of MOF file compilations.wbemprox.log,wmiprov.logand others: proxy and providers, depending on configuration.- The logging level is set in the Registry under
HKLM\SOFTWARE\Microsoft\WBEM\CIMOM,Loggingvalue.
Risks and best practices
- The
.logfiles can be archived or deleted without harming WMI, which recreates them. - Verbose logging left on fills the disk. Return to the default level once the diagnosis is done.
- To see who calls what in WMI, or to spot WMI abuse, read the
Microsoft-Windows-WMI-Activity/Operationallog instead.
Useful commands
# List the WMI logsGet-ChildItem -Force "$env:windir\System32\wbem\Logs" | Select-Object Name, Length, LastWriteTime
# Read the end of a WMI service logGet-Content "$env:windir\System32\wbem\Logs\wbemcore.log" -Tail 40
# Look for MOF compilation errorsSelect-String -Path "$env:windir\System32\wbem\Logs\mofcomp.log" -Pattern "error" | Select-Object -Last 20
# Read WMI activity in Event Viewer (the modern tracing)Get-WinEvent -LogName "Microsoft-Windows-WMI-Activity/Operational" -MaxEvents 20