title: ManagementObjectSearcher throws FileNotFoundException when iterating its objects in foreach loop
body: <p>I try to obtain some system information with several classes from <strong>System.Management</strong> namespace but any attempt to use <strong>ManagementObjectSearcher</strong> or <strong>ManagementObjectCollection</strong> collection items results in <strong>FileNotFoundException</strong>.</p>
  
  <p>Below I present the problematic piece of code:</p>
  
  <pre class="lang-cs prettyprint-override"><code>    public static string GetProcessorID() {
          var processorID = "";
          var query = "SELECT ProcessorId FROM Win32_Processor";
          var oManagementObjectSearcher = new ManagementObjectSearcher(query);
  
          foreach (var oManagementObject in oManagementObjectSearcher.Get()) {
              processorID = (string)oManagementObject["ProcessorId"];
              break;
          }
  
          return processorID;
      }
  </code></pre>
  
  <p>Exception is thrown in 'foreach' line, when trying to obtain next item from the collection.</p>
  
  <p>It is observed on machine with <strong>windows xp professional sp3</strong>, with <strong>visual studio 2008 professional</strong>. I suppose that it can be something with my cpu, which is <strong>intel dual core</strong> - the same program on other machine with similar environment works perfect. The main difference between those machines is cpu.</p>
  
  <p>Other parameters like MACAddress and SystemDrive provides the same problem, which suggests that it might be rather software issue (WMI?)</p>
  
  <p>Very similar problem is described here -> <a href="http://news.softpedia.com/news/XP-SP3-Win32-Processor-Class-Labels-Intel-Core-2-Duo-CPUs-Incorectly-90201.shtml" rel="nofollow">http://news.softpedia.com/news/XP-SP3-Win32-Processor-Class-Labels-Intel-Core-2-Duo-CPUs-Incorectly-90201.shtml</a> but the solution did not solved it.</p>
  
  <p>Any ideas? Thanks in advance.</p>
  
  <p>Dawid</p>