How can I resolve the "Provider loading failed" for WMI requests?

I use WMI to collect system information. It works great on every system I tested it on, but I have one or two users who report problems. Debug logs show that WMI code throws a "Provider loading failed" exception. I could not reproduce the problem.

Users have confirmed that the WMI service is running automatically.

Here's an exception:

System.Management.ManagementException: Provider load failure at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode) at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext() 

Any thoughts on how to fix and solve this problem?

+7
c # wmi
source share
5 answers

You might want to confirm that all DLLs are correctly registered (see http://msdn.microsoft.com/en-us/library/bb961987.aspx ).

+2
source share

One way to track down the root cause of the problem is to use the WBEMTest tool, which MS Scripting Guys say is one of the easy ways.

"To find a WMI class provider ..."

The Scripting Guys: Use PowerShell to Fix a Provider Download Failure Problem

The high-level steps specific to the Win32_NetworkAdapter are described in this Win32_network "vendor failure" adapter from Mark Wolzak in infoSupport.

  • Click "Start β†’ β†’ β†’ β†’ wbemtest
  • click "Connect ..." to connect to the namespace
  • execute the query "Select * from MSFT_WmiSelfEvent"
  • scroll down and track the following WMI events
  • See the details of any Msft_WmiProvider_InitializationOperationFailureEvent or Msft_WmiProvider_LoadOperationFailureEvent for the DLL causing the problem.

Thanks to Error loading WMI provider on Richard Siddaway's blog for pointing out this tool and specific methodology.

+3
source share

On user-controlled operating systems, disable UAC.

In my case: Ross replied that he did not allow it. I could load some WMI providers (logical drive), but not others (IIS). WMI Explorer tools (such as PowerGui) display the provider. This suggests that security policies may prevent WMI providers from loading. After disabling UAC, all WMI providers boot without errors.

Of course, you can leave the KLA on. I will update this answer if I find the necessary policies.

+2
source share

So, I know this is old, but I had the exact problem described above. It was very difficult for me to figure it out, so I thought that I would answer in the hope that this would help someone else.

I tried to load the WMI IIS provider and get the error "Provider loading failed." I could reproduce the problem by running my WMI request using wbemtest.exe.

I ran procmon.exe to show the download (or not loading in my case), and of course wmiprvse.exe downloaded the registry key saying that inetsrv was located in the C: \ windows directory - which was not on my machine ( C: \ windows have been replaced by c: \ winnt)

Updating the key solved my problem, but, nevertheless, here I came across the fact that I had some time trying to understand why I was getting this error, and running procmon when I executed my WMI request showed me a problem. I hope this will be for you too.

+2
source share

WMI registration is done in WMI (static classes.

WMI CIM Studio (part of WMI Tools from MS, IIRC) is useful for learning these classes (and, of course, easier than writing a lot of queries).

+1
source share

All Articles