Error code 0x80041006 means a Windows Management Instrumentation (WMI) query failed because the WMI provider ran out of memory, usually due to a slow or hung WMI service. The fix is to restart the WMI service and repair the WMI repository, which clears the stuck state and lets the query run again.
What Is WMI and Why Does It Fail?
Windows Management Instrumentation (WMI) is the framework Windows uses to expose system data—hardware details, running processes, event logs, and configuration settings—to scripts and management tools. Programs like System Center, PowerShell cmdlets (Get-WmiObject, Get-CimInstance), and many third-party monitoring tools rely on WMI to pull this information. When a tool asks WMI for data, it sends a query (usually in WQL, a SQL-like language) to the WMI service, which then retrieves the data from providers—small DLLs that know how to read specific system components.
Error 0x80041006 is the WMI-specific code for WBEM_E_OUT_OF_MEMORY. It means the WMI service or one of its providers could not allocate enough memory to complete the query. This is rarely a system-wide RAM shortage; it usually points to a specific provider that is stuck, leaking memory, or waiting on a resource that never becomes available. The result is the same: the query fails, and the calling tool shows an error like “0x80041006” or “Out of memory.”
Common Causes of the 0x80041006 Error
Understanding the cause helps you pick the right fix. The most frequent triggers are:
- A hung WMI provider—a provider that stops responding but never releases its memory, so subsequent queries accumulate until the service hits its limit.
- A corrupted WMI repository—the database that stores WMI class definitions and static data. If it becomes inconsistent, queries can loop or fail, and the service may consume excessive memory.
- Too many simultaneous WMI queries—when many scripts or monitoring tools hit WMI at once, the service can run out of memory under the load.
- Permission issues—sometimes a query fails because the account lacks access, but the error is reported as a memory issue if the provider misbehaves.
- Third-party software interference—some backup agents, security tools, or management agents install their own WMI providers that can conflict or leak.
How to Fix Error 0x80041006
Try these steps in order. Most cases resolve with the first one or two.
- Restart the WMI service. Open an elevated Command Prompt (Run as Administrator) and type:
net stop winmgmtthennet start winmgmt. This clears the service’s memory and often resolves transient hangs. If the service won’t stop, you may need to end the process tree first:taskkill /f /pid <PID>(find the PID withtasklist | findstr winmgmt). - Repair the WMI repository. In the same elevated prompt, run:
winmgmt /salvagerepository. This checks the repository for consistency and rebuilds it if needed. For a more thorough fix, usewinmgmt /resetrepository, which restores the original repository and re-registers all providers. Note that resetting loses custom WMI data (like some third-party settings), so salvage first. - Check for provider hangs. In the WMI event log (Event Viewer → Applications and Services Logs → Microsoft → Windows → WMI-Activity), look for events with ID 5857 or 5861 that mention a provider. If you see a specific provider name, you can disable it via
winmgmt /disableprovider(replace with the actual provider name). - Increase the WMI memory limit. This is rarely needed but possible. In the registry, navigate to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WBEM\WMIand add a DWORD valueMemoryLimit(in MB). The default is 0 (unlimited), but if a provider is misbehaving, setting a limit can prevent the service from exhausting system memory. However, this is a workaround, not a fix. - Uninstall third-party WMI providers. If the error started after installing a management agent, uninstall it and see if the error disappears. Also check the WMI-Activity log for the provider that is failing.
How to Prevent It from Happening Again
Prevention is about reducing the load and keeping the repository healthy:
- Limit concurrent WMI queries. If you run many scripts, space them out or use a single script that batches queries.
- Keep the repository clean. Periodically run
winmgmt /verifyrepositoryto check for inconsistencies, and usewinmgmt /salvagerepositoryif issues are found. - Update drivers and management tools. Outdated providers are more likely to leak memory. Ensure your system and third-party agents are up to date.
- Monitor WMI activity. Use Performance Monitor to watch the
WMI ObjectsandWMI Provider Operationscounters. If you see a steady increase in memory usage, you can identify the offending provider.
What the Error Means for Different Tools
The error appears in various contexts, and the fix is the same but the impact differs:
- PowerShell scripts using
Get-WmiObjectorGet-CimInstancewill fail with “0x80041006” or a generic “Out of memory” message. The script stops unless you add error handling. - System Center Operations Manager (SCOM) agents use WMI to collect health data. A persistent error can cause monitoring gaps.
- Third-party backup software that queries WMI for disk or service status may skip those checks, leading to incomplete backups.
- Windows built-in tools like “Disk Management” or “Device Manager” may show errors or fail to load properties if they rely on WMI for certain data.
When to Rebuild the WMI Repository
If the error persists after restarting the service and salvaging, a full reset is the next step. winmgmt /resetrepository re-creates the repository from scratch and re-registers all providers. This is safe for most systems, but it will lose any custom WMI data that third-party tools may have stored (like some configuration settings). After the reset, you may need to re-run the setup of those tools to re-register their providers.
Before resetting, back up the repository: winmgmt /backuprepository C:\backup\wmi.bak. If the reset causes new issues, you can restore with winmgmt /restorerepository C:\backup\wmi.bak. Note that the restore only works if the repository is in the same state as when the backup was taken.
Frequently Asked Questions
Is error 0x80041006 caused by low RAM?
Not usually. The error is specific to WMI’s memory allocation, not the system’s total RAM. A single provider can consume hundreds of megabytes, but that’s a leak, not a sign that you need more RAM.
Can I ignore the error if my scripts still work?
If only occasional queries fail, you might ignore it, but the underlying issue (a hung or leaking provider) will likely worsen. It’s better to fix it early to avoid system slowdowns.
Does resetting the WMI repository affect my system?
Resetting re-creates the repository and re-registers all providers. Your system’s functionality remains, but third-party tools that store data in WMI may need reconfiguration. Always back up first.
Why does the error happen more often on servers?
Servers often run more management agents and monitoring tools that query WMI frequently, increasing the chance that a provider hangs or leaks. The fix is the same as on a desktop.
What if the error appears during Windows startup?
This can happen if a startup script or service queries WMI before the service is fully ready. Try adding a delay to the script or setting the WMI service to “Automatic (Delayed Start)” in Services.msc.
Is there a way to see which provider is causing the error?
Yes. In Event Viewer, navigate to Windows Logs → System and look for events from “Microsoft-Windows-WMI-Activity” with IDs 5857 (provider loaded) or 5861 (provider unloaded). The event details include the provider name. You can also use the command wmic path Win32_Provider where "State = 'Unavailable'" get Name to list problematic providers.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- How to Turn Off Shutter Sound on iPhone
- VPN Setup on iPhone SE: Step-by-Step Guide
- Fix Internet Not Working on Windows 11
- Fix Right Click Not Working in Firefox
- Compare Two Columns with Comma Separated Values in Excel
- How to Limit Ad Tracking on iPhone Apps