Results 1 to 8 of 8

Thread: Obtain the serial number of the external hard drive, need help

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2018
    Posts
    49

    Obtain the serial number of the external hard drive, need help

    Hello,
    I have a problem that needs help. I use the following code (in the attached file) to obtain the serial number of an external hard drive (through the USB interface), but it can not give the result or the result is incorrect.

    When connected to the SATA port:

    Name:  1.png
Views: 723
Size:  5.6 KB

    When connected through a USB adapter:

    Name:  2.png
Views: 666
Size:  7.8 KB

    With some other code:

    Name:  3.png
Views: 649
Size:  8.7 KB

    It is still connected through the usb adapter, other programs still give good results:

    Name:  4.png
Views: 737
Size:  27.4 KB

    Thanks,

    Best regards

    Code:
    https://drive.google.com/file/d/1tQc...ew?usp=sharing

  2. #2
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    5,048

    Re: Obtain the serial number of the external hard drive, need help

    According to this https://stackoverflow.com/questions/...rddrive-in-vb6
    "152D20337A0C" might be your Serial-No, but you have to decode it
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  3. #3
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,480

    Re: Obtain the serial number of the external hard drive, need help

    The archive linked to seems to have been grabbed from this thread:

    http://www.vbforums.com/showthread.p...r-Admin-Rights

    I haven't had a reason to go back to revisit this, but reading the thread again it sounds like the code may only be a problem when run on XP or earlier. Since XP is dead now it is hard to get too worried about it.

  4. #4

    Thread Starter
    Member
    Join Date
    Dec 2018
    Posts
    49

    Re: Obtain the serial number of the external hard drive, need help

    Hello Everyone,
    [Zvoni] Thank you, I checked, "152D20337A0C" is the InstanceID of Hard Disk Box Adapter, it does not change with all hard drives

    [dilettante] Thank you, This happens with every version of Windows. I think it seems that Hard Disk Box Adapter has caused the returned information to be misleading.

    Best regards

  5. #5
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    5,048

    Re: Obtain the serial number of the external hard drive, need help

    Well, everything i could find uses WMI, so, there....
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  6. #6

    Thread Starter
    Member
    Join Date
    Dec 2018
    Posts
    49

    Re: Obtain the serial number of the external hard drive, need help

    Quote Originally Posted by Zvoni View Post
    Well, everything i could find uses WMI, so, there....
    Thank Zvoni, I tried with WMI, and the information returned is also the InstanceID of Hard Disk Box Adapter

  7. #7
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    10,835

    Re: Obtain the serial number of the external hard drive, need help

    Here's something I'd be interested in knowing: Does that Western Digital tool work with a non-WD USB hard disk? I bet it doesn't.

    So, we really need to re-frame your question. Is what you want the serial number of Western Digital USB drives? But even that might be quite difficult, and here's why. The Western Digital corporation certainly knows how to communicate with their drives at a very low-level. In other words, their Data Lifeguard Tools program is quite possibly going directly to their hard drive to get the information, and not going through Windows API calls. To do that from another program, you'd need to know very detailed (quite possibly proprietary) information about how to communicate with the drive's firmware. And I seriously doubt you're going to find information on how to do that from anybody except some Western Digital firmware specifications sheet.

    And then, when you're all done, it probably won't work on other USB hard drives from other companies like Hitachi, Seagate, Toshiba, etcetera, as they'll all have different protocols for communicating directly with their firmware.

    You need to find an example of some code that uses standard API calls (possibly digging something out of the registry similar to a monitor's EDID information) before this will become standardized.

    Good Luck,
    Elroy
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  8. #8

    Thread Starter
    Member
    Join Date
    Dec 2018
    Posts
    49

    Re: Obtain the serial number of the external hard drive, need help

    Quote Originally Posted by Elroy View Post
    Here's something I'd be interested in knowing: Does that Western Digital tool work with a non-WD USB hard disk? I bet it doesn't.

    So, we really need to re-frame your question. Is what you want the serial number of Western Digital USB drives? But even that might be quite difficult, and here's why. The Western Digital corporation certainly knows how to communicate with their drives at a very low-level. In other words, their Data Lifeguard Tools program is quite possibly going directly to their hard drive to get the information, and not going through Windows API calls. To do that from another program, you'd need to know very detailed (quite possibly proprietary) information about how to communicate with the drive's firmware. And I seriously doubt you're going to find information on how to do that from anybody except some Western Digital firmware specifications sheet.

    And then, when you're all done, it probably won't work on other USB hard drives from other companies like Hitachi, Seagate, Toshiba, etcetera, as they'll all have different protocols for communicating directly with their firmware.

    You need to find an example of some code that uses standard API calls (possibly digging something out of the registry similar to a monitor's EDID information) before this will become standardized.

    Good Luck,
    Elroy
    Hi Elroy,

    I tried Western Digital's tool with a variety of different hard drives, and it all yielded accurate results. And not only WD, some other drive tools (eg CrystalDiskInfo, HD Tune ...) also get the Serial Number of USB hard drives.

    I really feel very stuck on this issue. Is there any way for messages to go through Hard Disk Adapter Box to reach the Hard Disk?

    Best regards,
    ferrmask

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width