I need to get the hardware serial number of all types of drives on xp and win2k, I have this code
searcher = new ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia");
foreach (ManagementObject wmi_HD2 in searcher.Get())
This works fine on IDE drives, but fails with an object reference not set exception when trying to get the serialnumber of a scsi or sata drive, does anyone know how to do this.
In fact it does not have to be the serial number, as long as it is a unique piece of hardware data. When I say unique, I mean each manufactured drive must have a different id of some sort.
Please note that I need the hardware serial, not the volume serial.
Actually any info on how I can identify a machine uniquely would be useful. I want to use this for locking software to a machine.
Thanks in advance