Click here to Skip to main content
14,303,609 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hello friends,

At first it may seems it is very easy question and some body may be trying to give me advice to try Google…..it may be…….

But for me it is very hard I have try Google and can’t find any good solution…
What should be is…..
Just want to get Serial no of Hard Disk or Hard Drive….using C#
Please read carefully, serial no of Hard Disk, But not Serial no of Volume of Hard Disk (e.g. C, D, E..etc).

For getting serial no of volume of hard disk I have found solution on net and its work well but problem is with Getting serial no of Hard Disk………
Some body may trying to make this question as possible copy of Below question or may suggest link of that question….But it is not

And not any below question provide good solution for this problem in C#....
1. http://stackoverflow.com/questions/4559700/how-to-get-hard-disk-serialnumber-in-c-no-wmi
2. http://stackoverflow.com/questions/3139276/how-to-retrieve-hdd-firmware-serial-number-in-net
3. http://stackoverflow.com/questions/677251/hdd-serial-number
One article (in C#) at link, it gives every parameter nicely other than serial no…
How to Retrieve the REAL Hard Drive Serial Number
You can read discussion at below that article to conform………
Posted
Updated 15-Apr-11 2:35am
v4
Comments
Dalek Dave 7-Nov-11 3:33am
   
Actually, that is a fairly good question, and well set out.
Pritesh Aryan 11-Nov-11 2:04am
   
Thank you so mcuh Dalek Dave for your compliment.
Rate this:
Please Sign up or sign in to vote.

Solution 2

   
Rate this:
Please Sign up or sign in to vote.

Solution 3

Or have a look at this article about WMI that gives you a lot of info including the harddisk serial.
How To Get Hardware Information (CPU ID, MainBoard Info, Hard Disk Serial, System Information , ...)[^]

Good luck!
   
Rate this:
Please Sign up or sign in to vote.

Solution 4

Hello friends............
this is the final solution............

Get Physical HDD Serial Number without WMI[^]

write this much code..........
DriveListEx diskInfo = new DriveListEx();
            diskInfo.Load();
            string serialNo = diskInfo[0].SerialNumber;

Dont't forgot to add reference to the "DriveInfoEx.dll".....
   
v3
Comments
avigodse 15-Apr-11 11:38am
   
But, this actually gives drive volume serial number, which is tend to change if formatted or partitioned.
Rate this:
Please Sign up or sign in to vote.

Solution 7

Great work!Thank for your solution!!!
   
Rate this:
Please Sign up or sign in to vote.

Solution 8

This is a pretty good solution and even better if you have C# knowledge http://www.geekpedia.com/tutorial233_Getting-Disk-Drive-Information-using-WMI-and-Csharp.html[^]
   
Comments
CHill60 1-Sep-15 8:26am
   
C# example using WMI was posted over 4 years ago. This solution adds nothing.

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100