Click here to Skip to main content
16,017,852 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I want to create a program that get a unique number or serial to me , for this job i want to get serial number of c drive of computer in csharp , because i think that it is unique for any computer in the world , is there any other way?
if yes , please say to me , what way can i try?
if no , please say how can i get serial number of "c" drive in csharp?
Posted
Updated 6-Jul-11 2:34am
v3

Look at WMI via the System.Management namespace[^] - it provides calls to access all sorts of information about a PC.

But be aware, that simple security like this is easily hacked, and will frequently annoy genuine customers more than it deters pirates. A quick look at any of the torrent sites will show you what I mean...

[edit]I forgot to add this: How To Get Hardware Information (CPU ID, MainBoard Info, Hard Disk Serial, System Information , ...)[^] - an article on this very site which shows you how to get loads of info, including the HDD serial number - OriginalGriff[/edit]
 
Share this answer
 
v2
That's nice and all, but getting the hard disk serial number has one major drawback. First, WMI cannot be used to consistantly get the serial number on all drives and on all platforms. There is nothing that says a manufacturer has to provide this information to WMI.

Second, there are about 4 different methods of getting the serial number of any single drive. Not every method works on every drive, so you'd have to try each method, evaluate what you get, then try the next method if needed, and so on.

Lastly, if your software is installed on a machine with multiple drives in a hardware RAID array, you cannot get the serial number of the drives. They are hidden by the array controller and the O/S only sees the RAID "drive". That "drive" usually will not have a serial number.
 
Share this answer
 
 
Share this answer
 
See[^] how easy it is.
 
Share this answer
 

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