Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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" && 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();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement