开发者

System.Management.ManagementException: Not found

I am running the foll开发者_Python百科owing code:

ManagementClass oMClass = new ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection colMObj = oMClass.GetInstances();

which is throwing this exception:

System.Management.ManagementException: Not found 
at System.Management.ThreadDispatch.Start()
at System.Management.ManagementScope.Initialize()
at System.Management.ManagementObject.Initialize(Boolean getObject)
at System.Management.ManagementClass.GetInstances(EnumerationOptions options)
at System.Management.ManagementClass.GetInstances()

I went to check on the running services on Windows XP and found that Windows Management Instrumentation service has a status of 'Started'. I tried restarting the service but that didn't do any good. I then tried to get the status of this service from within my running code using the ServiceController class:

ServiceController wpiService = new ServiceController();
wpiService.ServiceName = "Winmgmt";
string wmiStatus = wpiService.Status.ToString();
MessageBox.Show("WMI status= " + wmiStatus);

wmiStatus evaluates to 'Running'.

I have seen this error on only one of multiple machines running the same software. What's peculiar is that the machine was running smoothly for months, and then suddenly started showing this error.

Any clue as to what might be causing this?


I have also run into this issue. Here is one of the previously mentioned online resources explaining how one can fix WMI: http://windowsxp.mvps.org/repairwmi.htm

The method of repairing seems to be different between different versions of Windows as explained on that page.

I had this problem on none of these versions, but on Windows Embedded Standard 2009. Since Windows XP Service Pack 2 is closest related to the listed OSes, that is the one I used:

For Windows XP Service Pack 2

Click Start, Run and type the following command:

rundll32 wbemupgd, UpgradeRepository

This command is used to detect and repair a corrupted WMI Repository. The results are stored in the setup.log (%windir%\system32\wbem\logs\setup.log) file.


The solution was to repair WMI on Windows XP. I don't have the detailed step by step fix (I'm not the one who implemented the fix), but my understanding is that a repository related to this service can get corrupted and there's a Windows utility that can repair it. There are several online resources on how to do this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜