Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
224 views
in Technique[技术] by (71.8m points)

c# - How can I resolve a "Provider load failure" for WMI requests?

I'm using WMI to collect system information. It works fine on every system I've tested it on, but I have one or two users that are reporting problems. The debug logs show the WMI code is throwing a "Provider load failure" exception. I haven't been able to replicate the issue.

The users have verified that the WMI service is running in Automatic mode.

Here's the 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 troubleshoot and resolve this issue?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

One way to possibly track down the root cause of the issue is to use WBEMTest a tool that the MS Scripting Guys say is one of the easiest ways

"To find the provider of a WMI class..."

The Scripting Guys: Use PowerShell to Troubleshoot “Provider Load Failure”

The high level steps specific to the Win32_NetworkAdapter are described in this Win32_network adapter "provider load failure" post by Mark Wolzak at infoSupport.

  • Click start >> run >> wbemtest
  • click 'Connect…' to connect to a namespace
  • execute the query 'Select * From MSFT_WmiSelfEvent'
  • scroll down to the bottom and trace the following WMI events
  • Look at the details of any Msft_WmiProvider_InitializationOperationFailureEvent or Msft_WmiProvider_LoadOperationFailureEvent for the dll that is causing the issue

Thanks to the WMI–Provider Load Failure post at Richard Siddaway's Blog for pointing me to this tool and specific methodology.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...