Vorrei da codice managed scoprire se il mio programma gira su una Virtual Machine.

Purtroppo fino ad ora ho trovato solo questo che funziona solo su Virtual PC:

   1:          private bool IsRunningOnVM()
   2:          {
   3:              string manufacturer = "";
   4:   
   5:              ManagementObjectSearcher query;
   6:              ManagementObjectCollection queryCollection;
   7:   
   8:              ManagementScope msc = new ManagementScope(@"root\cimv2");
   9:              String queryCommand = "Select * from Win32_BaseBoard";
  10:   
  11:              SelectQuery selectQuery = new SelectQuery(queryCommand);
  12:              query = new ManagementObjectSearcher(msc, selectQuery);
  13:              queryCollection = query.Get();
  14:   
  15:              foreach (ManagementObject item in queryCollection)
  16:              {
  17:                  manufacturer = item["Manufacturer"].ToString();
  18:                  //Console.WriteLine(manufacturer);
  19:              }
  20:   
  21:              if (String.Compare(manufacturer, "Microsoft Corporation", true) == 0)
  22:                  return true;
  23:              else
  24:                  return false;
  25:          }

 

Intanto continuo le ricerche e le sperimentazioni (manca WMWare e VirtualBox)