1. Sivaprakash BKR
  2. PowerBuilder
  3. Tuesday, 8 December 2020 06:31 AM UTC

Hello,

This is not the relevant forum for this.  Still thought that someone could guide me in the right direction.

I want to read the manufacturer-assigned serial number of an external hard disk, which is (almost) unique and won't change even if it's formatted.  I want to use it for securing my application.

Is that any tool (ActiveX or DLL or similar, free / paid) that could help us to read the unique serial number of any external hard disk?

Happiness Always
BKR Sivaprakash

 

Benjamin Gaesslein Accepted Answer Pending Moderation
  1. Tuesday, 8 December 2020 06:44 AM UTC
  2. PowerBuilder
  3. # 1

Google is a thing, you know.

https://winaero.com/find-hard-disk-serial-number-windows-10/

Comment
  1. Sivaprakash BKR
  2. Wednesday, 9 December 2020 05:59 AM UTC
It seems that we could not read the serial number of external hard disk either in powershell. The following command in the powershell

Get-WMIObject win32_physicalmedia | Format-List Tag,SerialNumber.



I get some junk like thing in serialnumber output ....

  1. Helpful
  1. Benjamin Gaesslein
  2. Wednesday, 9 December 2020 07:14 AM UTC
I'm not sure, sorry. It seems to work fine with external HDDs at my PC at home.

Looks like there's an issue in Windows 7 with certain characters in hdd serial numbers. A hotfix was available but since Windows 7 is no longer supported by Microsoft, I don't think it is obtainable now.



https://support.microsoft.com/en-us/help/2664203/invalid-xml-content-error-message-when-you-run-a-wmic-command-in-windo
  1. Helpful
  1. Sivaprakash BKR
  2. Friday, 11 December 2020 08:17 AM UTC
Now, I tried with 2 hdd (Toshiba and WD) with wmic command

Toshiba - returns junk in Win 7, returns serial number in Win 10. This is the one that I was trying from the beginning.

WD - works fine in both Win 7 and Win 10.



I tried copying wmic.exe file from Win 10 machine to Win 7 machine, command itself doesn't work in Win 7. (Didn't expect it to work either, just tried).

Few HDD may not return correct serial number in Win 7, and no solution available as of now.
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 8 December 2020 15:44 PM UTC
  2. PowerBuilder
  3. # 2

Hi BKR;

   Try using this PB Code.

HTH

Regards ... Chris

 

Comment
  1. Chris Pollach @Appeon
  2. Tuesday, 8 December 2020 18:10 PM UTC
Good tips John ... Thanks!
  1. Helpful
  1. Sivaprakash BKR
  2. Wednesday, 9 December 2020 04:51 AM UTC
Thanks Chris and John Fauss,

Sure, I want only the Manufacturer assigned serial number and NOT the volume serial number assigned by OS.



While googling, I read about a tool (paid one) that does this work, to read manufacturer serial number on every possible environment. I forgot where I saw this tool, and couldn't get back that website.



  1. Helpful
  1. Chris Pollach @Appeon
  2. Wednesday, 9 December 2020 22:01 PM UTC
Hi John;

This external function (with a few tweaks) is now working great for me in my framework ....

FUNCTION Long GetVolumeInformation ( string lpRootPathName, REF string lpVolumeNameBuffer, ulong nVolumeNameSize, REF ulong lpVolumeSerialNumber, REF ulong lpMaximumComponentLength, REF ulong lpFileSystemFlags, REF string lpFileSystemNameBuffer, ulong nFileSystemNameSize) LIBRARY "Kernel32.dll" ALIAS FOR "GetVolumeInformationW"

FYI: I also noticed that is supports UNC drive mappings as well. :-)

Regards ... Chris
  1. Helpful
There are no comments made yet.
Sivaprakash BKR Accepted Answer Pending Moderation
  1. Friday, 11 December 2020 08:19 AM UTC
  2. PowerBuilder
  3. # 3

Is there any way to lock a program to a particular external hdd ?  That's what I'm trying to achieve with manufacturer's serial number of external hdd.   If it's not guaranteed to work in Win 7, then I need to search some other alternative ways to achieve it.

Happiness Always
BKR Sivaprakash

 

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.