PhysicalMedia instead of LogicalDisk
-
This short bit of code works well for getting the VolumeSerialNumber using win32_logicaldisk:
ManagementObject disk=new ManagementObject("win32\_logicaldisk.deviceid='C:\\'"); this.textBox2.Text = disk.Properties\["VolumeSerialNumber"\].Value.ToString();
However, I would like to get the manufacturer serial number. I know this is available in win32_PhysicalMedia, but I can't find anything that tells me precisely what the "serial number" is named.
-
This short bit of code works well for getting the VolumeSerialNumber using win32_logicaldisk:
ManagementObject disk=new ManagementObject("win32\_logicaldisk.deviceid='C:\\'"); this.textBox2.Text = disk.Properties\["VolumeSerialNumber"\].Value.ToString();
However, I would like to get the manufacturer serial number. I know this is available in win32_PhysicalMedia, but I can't find anything that tells me precisely what the "serial number" is named.
A little Google goes a long way. All I did was search for "Win32_PhysicalMedia" and wallah[^]!! It's called, oddly enough,
SerialNumber
. The problem you're going to run into is that there is nothing that says a manufacturer has to fill this field in. This field may come back empty for any given drive or media.A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
A little Google goes a long way. All I did was search for "Win32_PhysicalMedia" and wallah[^]!! It's called, oddly enough,
SerialNumber
. The problem you're going to run into is that there is nothing that says a manufacturer has to fill this field in. This field may come back empty for any given drive or media.A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007Yup. Did the Google thing. I always do before I bother all you hard working folks. Found the same thing you did, tried it, and my little app crashed -- thought maybe I hadn't found the right name after all. I suppose, based on what you say, it might mean there is no serial for my harddrive. Bummer.
-
Yup. Did the Google thing. I always do before I bother all you hard working folks. Found the same thing you did, tried it, and my little app crashed -- thought maybe I hadn't found the right name after all. I suppose, based on what you say, it might mean there is no serial for my harddrive. Bummer.
The last time I did this, only 2 out of 6 of my drives filled in the Serial Number field...
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
The last time I did this, only 2 out of 6 of my drives filled in the Serial Number field...
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007That's too bad. It would sure make my life easier if it was a standard all manufacturers followed. Thanks for the feedback.