user2374929
user2374929

Reputation: 21

Where can I get info about notebook's model name?

I trying to get info about HW from notebooks. I do this via WMI, but not always there contains the info about notebook model for example. It depends on the manufacturer, SONY never contains HW info in WMI.

            FileStream fs = new FileStream(@"C:\log.txt", FileMode.OpenOrCreate);
        StreamWriter sw = new StreamWriter(fs);
        string[] Names = { "Win32_Fan", "Win32_HeatPipe", "Win32_Refrigeration", "Win32_TemperatureProbe", "Win32_Keyboard", "Win32_PointingDevice",
                             "Win32_AutochkSetting", "Win32_CDROMDrive" , "Win32_DiskDrive" ,"Win32_FloppyDrive", "Win32_PhysicalMedia","Win32_TapeDrive" ,
                         "Win32_1394Controller","Win32_1394ControllerDevice", "Win32_AllocatedResource", "Win32_AssociatedProcessorMemory","Win32_BaseBoard",
                         "Win32_BIOS", "Win32_Bus","Win32_CacheMemory","Win32_ControllerHasHub","Win32_DeviceBus","Win32_DeviceMemoryAddress", "Win32_DeviceSettings",
                         "Win32_DMAChannel","Win32_FloppyController","Win32_IDEController","Win32_IDEControllerDevice","Win32_InfraredDevice","Win32_IRQResource","Win32_MemoryArray",
                         "Win32_MemoryArrayLocation","Win32_MemoryDevice","Win32_MemoryDeviceArray","Win32_MemoryDeviceLocation","Win32_MotherboardDevice","Win32_OnBoardDevice",
                         "Win32_ParallelPort","Win32_PCMCIAController","Win32_PhysicalMemory","Win32_PhysicalMemoryArray","Win32_PhysicalMemoryLocation","Win32_PNPAllocatedResource",
                         "Win32_PNPDevice","Win32_PNPEntity","Win32_PortConnector","Win32_PortResource","Win32_Processor","Win32_SCSIController", "Win32_SCSIControllerDevice","Win32_SerialPort",
                         "Win32_SerialPortConfiguration","Win32_SerialPortSetting","Win32_SMBIOSMemory","Win32_SoundDevice","Win32_SystemBIOS","Win32_SystemDriverPNPEntity","Win32_SystemEnclosure",
                         "Win32_SystemMemoryResource","Win32_SystemSlot","Win32_USBController","Win32_USBControllerDevice","Win32_USBHub","Win32_NetworkAdapter",
                         "Win32_NetworkAdapterConfiguration","Win32_NetworkAdapterSetting","Win32_Battery","Win32_CurrentProbe","Win32_PortableBattery",
                         "Win32_PowerManagementEvent","Win32_VoltageProbe","Win32_DriverForDevice","Win32_Printer","Win32_PrinterConfiguration","Win32_PrinterController",
                         "Win32_PrinterDriver","Win32_PrinterDriverDll","Win32_PrinterSetting","Win32_PrintJob","Win32_TCPIPPrinterPort","Win32_POTSModem","Win32_POTSModemToSerialPort",
                         "Win32_DesktopMonitor","Win32_DisplayConfiguration","Win32_DisplayControllerConfiguration","Win32_VideoConfiguration","Win32_VideoController","Win32_VideoSettings"};

        foreach (string name in Names)
        {
            sw.WriteLine("                                                                           ");
            sw.WriteLine("<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
            sw.WriteLine(name);
            sw.WriteLine("<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");

            ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM " + name);
            ManagementObjectCollection information = searcher.Get();

            foreach (ManagementObject obj in information)
            {

                foreach (PropertyData data in obj.Properties)
                {

                    sw.WriteLine("{0} = {1}", data.Name, data.Value);
                }
            }

        }
        sw.Close();

Where can I get this info? Thanks!

Upvotes: 2

Views: 1841

Answers (3)

SMartDev
SMartDev

Reputation: 112

This is available in the registry at this key:

HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS

The value "SystemManufacturer" will have the make, and "SystemProductName" will have the model.

This can be read using the C# code:

class Program
{
    static void Main(string[] args)
    {
        var manufacturer = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("HARDWARE\\DESCRIPTION\\System\\BIOS").GetValue("SystemManufacturer");
        var model = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("HARDWARE\\DESCRIPTION\\System\\BIOS").GetValue("SystemProductName");
    }
}

Upvotes: 1

user2374929
user2374929

Reputation: 21

Model and serial number contain in the "Win32_ComputerSystemProduct".

Upvotes: 0

Garett
Garett

Reputation: 16828

You could try getting this information from the BIOS information, which is stored in the registry under the HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS. It should be in the SystemProductName or SystemVersion value.

Upvotes: 3

Related Questions