Click here to Skip to main content
15,885,891 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone.

I'm developing a project that uses the HDD serial number of main disk to elaborate a machine fingerprint.

I want to clear something. I have seen many post everywhere talking about the partition signature as if was the HDD serial number. I'm talking about the HDD SERIAL NUMBER provided by the disk when is consulted.

In that process I encountered and error in a client machine. I had the oportunity to make experiments with that machine, and seems each time the code requests the serial number using the WMI, the system return sometime the correct value and sometimes returns string apparently random.

The code is working good in aproximately 200 different machines... but in that machine fails...

I assumed maybe is a malfunction in the harddisk.

So... I want to know if somebody know (if that exists): What are the allowed characters in a harddisk's serial number?

If I can check the characters, I can retry the request until to get a "logic" serial value.

Thanks.

PD: Excuse me if my expressions in english are not correctly or the introduction too long. :)
Posted

1 solution

It's a "manufacturer specific string" which translates to English as: "They can put anything they like in there".
Normally, it is upper case Alphanumeric only, with a few special characters (hyphen, slash, space are the normal ones).

Are you sure you are retrieving it correctly? It is unlikely that it would change and the drive still function properly, so the first thing I would be checking is the code I was using. Is it possible that you are getting the ID from a solid-state device pretending to be a HDD instead? A USB disk for example?

It may be worth reading it several times and comparing them to see it it changes - but I'm not sure when WMI reads the info - just on device detect, or on demand.
 
Share this answer
 
Comments
th3darkzi0n 30-Nov-12 3:43am    
I think the code is OK. I tested it in many machines and is working perfectly. Only that machine is giving me problems.

I wrote an small program with the same code to execute many time by the user and store the results.

60% of times the result was a "normal" serial code (always the same). The others was all different senseless strings.

All disks had been requested and only that disk is not working...
I think a malfunction is the only explanation (the hardisk or maybe some problem with the driver).

Like I thought, any manufacturer can put anything there, i hope all characters be printables and without rare symbols... :(
OriginalGriff 30-Nov-12 3:50am    
"60% of times the result was a "normal" serial code (always the same). The others was all different senseless strings."

Oh dear - it's probably a fault then. You could work round it - read it until you get three "good" reads in a row - but I would advise the customer that he might want to consider checking his hardware and backing up his data. HDD's don't last forever, and faults don't "get better" :laugh:
th3darkzi0n 30-Nov-12 4:02am    
Hahahaha. I'm totally agree about he must replace the HDD. But this was a fortunate problem, because was somebody that we know and we can test and be prepared for similar (and really unexpected) problem.

I'm agree about to check many coincidences to accept a serial.

Thanks for your response.
OriginalGriff 30-Nov-12 4:07am    
You're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900