I am running the following 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With