Hi all.

I'm having some difficulty getting some hardware info

I can get the Hdd serial, and CPUID.

string cpuInfo = string.Empty;
            ManagementClass managementClass = new ManagementClass("win32_processor");
            ManagementObjectCollection managementObjectCollection = managementClass.GetInstances();

            foreach (ManagementObject managementObject in managementObjectCollection)
            {
                if (cpuInfo == "")
                {
                    //Get only the first CPU's ID
                    cpuInfo = managementObject.Properties["processorID"].Value.ToString();
managementObject.Dispose();
                    break;
                }
            }
            MessageBox.Show(cpuInfo);
string hdd = "c";
            ManagementObject disk = new ManagementObject(@"win32_logicaldisk.deviceid=""" + hdd + @":""");
            disk.Get();
            string volumeSerial = disk["VolumeSerialNumber"].ToString();
            disk.Dispose();
            MessageBox.Show(volumeSerial);

But I cannot find a way to get Bios and motherboard info.

Love any help if you can offer it.

Thank you.

That page shows the same basic code as in what I've posted.

I'm still having problems trying to figure what to put in the string.

cpuInfo = managementObject.Properties["processorID"].Value.ToString();

Thats for the cpu but what property to enter for BIOS?

You will have to do what they do in their example and, at least the first time, display all the properties that are returned since you don't know the name of what you want:

ManagementObjectSearcher searcher = new ManagementObjectSearcher("select * from Win32_BIOS");
foreach (ManagementObject share in searcher.Get()) {
    foreach (PropertyData PC in share.Properties) {
        /// ... code here ...
    }
}

You'll have to look up the PropertyData class and add what you want to see (as I said, the first time, show everything, next time you know what to look for).

I feel a little silly now, I should really have thought to do that.

Thanks again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.