dcsimg
Results 1 to 8 of 8

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

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2018
    Posts
    18

    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: 162
Size:  5.6 KB

    When connected through a USB adapter:

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

    With some other code:

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

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

    Name:  4.png
Views: 156
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
    2,005

    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
    One System to rule them all, One IDE to find them,
    One Code 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.
    ---------------------------------------------------------------------------------
    For health reasons i try to avoid reading unformatted Code

  3. #3
    PowerPoster
    Join Date
    Feb 2006
    Posts
    20,719

    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
    Junior Member
    Join Date
    Dec 2018
    Posts
    18

    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
    2,005

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

    Well, everything i could find uses WMI, so, there....
    One System to rule them all, One IDE to find them,
    One Code 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.
    ---------------------------------------------------------------------------------
    For health reasons i try to avoid reading unformatted Code

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Dec 2018
    Posts
    18

    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
    5,842

    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. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Dec 2018
    Posts
    18

    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
  •  



Featured


Click Here to Expand Forum to Full Width