none
Get DMI information in C# RRS feed

  • Question

  • Hi,

    I know each PC has a collection of information that stores information like its manufecturer name, its model number, etc. that is called the DMI.

    I tried to search for a method to get this collection of information in C# on the web, but didn't find much useful information, could you tell me the way to read DMI data in C#?

    Thanks a lot in advance!

    Monday, June 11, 2012 7:12 AM

Answers

  • I've successfully got the DMI information using this code:

            static void Main(string[] args)
            {
                using (ManagementClass devs = new ManagementClass(
                            @"Win32_ComputerSystem"))
                {
                    ManagementObjectCollection moc = devs.GetInstances();
                    foreach (ManagementObject mo in moc)
                    {
                        Console.WriteLine(mo["Manufacturer"]);
                        Console.WriteLine(mo["Model"]);
                        Console.WriteLine(mo["Name"]);
                        Console.WriteLine(mo["PCSystemType"]);
                        Console.WriteLine(mo["UserName"]);
                    }
    
                }
            }

    
    • Marked as answer by Beverly1984 Tuesday, June 12, 2012 6:28 AM
    Tuesday, June 12, 2012 6:28 AM

All replies

  • try this link http://msdn.microsoft.com/en-us/library/windows/desktop/aa394102%28v=vs.85%29.aspx

    Mark Answered, if it solves your question and Vote if you found it helpful.
    Rohit Arora

    Monday, June 11, 2012 7:34 AM
  • I've successfully got the DMI information using this code:

            static void Main(string[] args)
            {
                using (ManagementClass devs = new ManagementClass(
                            @"Win32_ComputerSystem"))
                {
                    ManagementObjectCollection moc = devs.GetInstances();
                    foreach (ManagementObject mo in moc)
                    {
                        Console.WriteLine(mo["Manufacturer"]);
                        Console.WriteLine(mo["Model"]);
                        Console.WriteLine(mo["Name"]);
                        Console.WriteLine(mo["PCSystemType"]);
                        Console.WriteLine(mo["UserName"]);
                    }
    
                }
            }

    
    • Marked as answer by Beverly1984 Tuesday, June 12, 2012 6:28 AM
    Tuesday, June 12, 2012 6:28 AM