title: How to know in C# that program is running on Parallels on a Mac running XP SP2 or VmWare on a Mac running Windows 7
body: <p>I am using the following code to indicate if code is executed on virtual machine. </p>
  
  <pre><code>using (var searcher = new ManagementObjectSearcher("Select * from Win32_ComputerSystem"))
  {
      using (var items = searcher.Get())
      {
          foreach (var item in items)
          {
              string manufacturer = item["Manufacturer"].ToString().ToLower();
              Console.WriteLine("Manufacturer: " + manufacturer);
              Console.WriteLine("Model: " + item["Model"].ToString());
              if ((manufacturer == "microsoft corporation" &amp;&amp; item["Model"].ToString().ToUpperInvariant().Contains("VIRTUAL"))
                  || manufacturer.Contains("vmware")
                  || item["Model"].ToString() == "VirtualBox")
              {
                  Console.WriteLine("Manufacturer: " + manufacturer);
                  Console.WriteLine("Model: " + item["Model"].ToString());
              }
          }
      }
  }
  Console.Read();
  </code></pre>
  
  <p>But in addition to that I have to know if it is a Parallel or VnWare. Any idea? 
  Thank you</p>
  
  <p>Base on the answer provided Final code will be like that, it works for me ok:</p>
  
  <pre><code>                using (var searcher = new ManagementObjectSearcher("Select * from Win32_ComputerSystem"))
              {
                  //TODO: Have to verify the difference between Parallel and Vm
                  using (var items = searcher.Get())
                  {
                      foreach (var item in items)
                      {
                          string manufacturer = item["Manufacturer"].ToString().ToLower();
                          string model = item["Model"].ToString().ToLower();
                          if (manufacturer.Contains("parallels") &amp;&amp; model.Contains("parallels"))
                          {
                              Console.WriteLine("Parallels Detected");
                          }
                          else if(manufacturer.Contains("vmware"))
                          {
                              Console.WriteLine("VMWARE Detected");
                          }
                      }
                  }
              }
  </code></pre>