Jump to content

How to show the printed serial number of an external usb hard drive using c#


ramzi2015

Recommended Posts

I need to show the printed serial number of an external usb hard drive using c# .
I have found many sources in "github" but the returned serial number is not correct. the only program that gave me the correct serial number is "CrystalDiskInfo" which is open source but written in c ++ which I do not understand.

Here is an example with "CrystalDiskInfo" with the correct result:

hdd6.png.9220ddb01df52a87b64d8ad3a597e0b7.png

Thanks for help

Link to comment
24 minutes ago, ramzi2015 said:

do not forget that it is an external Usb hard drive

You never mentioned that. :) USB enclosures are tricky, some of them they report their own serial numbers and some - serial numbers of the actual hard disk.
My WD Book enclosure works fine with the code I suggested earlier.

 

Try running in command prompt:

wmic diskdrive get Name,Model,SerialNumber,Size,Status

If you don't see the correct information there, then C# application will not be able to get it without writing a lot of specific code (like Crystal Disk Info).

Edited by kao
sometimes -> some of them
  • Like 1
Link to comment
39 minutes ago, kao said:

You never mentioned that. :) USB enclosures are tricky, some of them they report their own serial numbers and some - serial numbers of the actual hard disk.
My WD Book enclosure works fine with the code I suggested earlier.

 

Try running in command prompt:


wmic diskdrive get Name,Model,SerialNumber,Size,Status

If you don't see the correct information there, then C# application will not be able to get it without writing a lot of specific code (like Crystal Disk Info).

No luck, the serial number is still incorrect with the "wmic" command.  I think things are more complicated than I thought. So, I will try to use a third party tool to get the correct result.

Thank you anyway

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...