Advertisement
Guest User

Untitled

a guest
Feb 27th, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. using (var searcher = new ManagementObjectSearcher("Select * from Win32_ComputerSystem"))
  2. {
  3. using (var items = searcher.Get())
  4. {
  5. foreach (var item in items)
  6. {
  7. string manufacturer = item["Manufacturer"].ToString().ToLower();
  8. Console.WriteLine("Manufacturer: " + manufacturer);
  9. Console.WriteLine("Model: " + item["Model"].ToString());
  10. if ((manufacturer == "microsoft corporation" && item["Model"].ToString().ToUpperInvariant().Contains("VIRTUAL"))
  11. || manufacturer.Contains("vmware")
  12. || item["Model"].ToString() == "VirtualBox")
  13. {
  14. Console.WriteLine("Manufacturer: " + manufacturer);
  15. Console.WriteLine("Model: " + item["Model"].ToString());
  16. }
  17. }
  18. }
  19. }
  20. Console.Read();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement