Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
4
Erster Beitrag:
vor 1 Jahr, 5 Monaten
Letzter Beitrag:
vor 1 Jahr, 5 Monaten
Beteiligte Autoren:
GuenterP, Al

[All] Message to the lurkers and forum guests.

Startbeitrag von Al am 02.05.2016 20:55

Hello to all the lurkers/guests.

I have just answered a question on the forum re obtaining a hard disk serial number - a relatively simple and straight forward request.
At the time I answered it, there had been 46 views of the question and I asked myself why none of the 46 had posted an answer ?

In this case I searched the forum and found the same question had been asked in 2008 and oddly enough I had answered it back than also.

Posting answers is an easy way to learn more about WIndev so why not give it a go.

So, don't stay on the bank, jump in, the waters fine.

Regards
Al

Antworten:

Hi Al,
unfortunately, the "serial number" result from fDriveInfo() is the serial number that anyone can change at any time. See: https://www.raymond.cc/blog/changing-or-spoofing-hard-disk-hardware-serial-number-and-volume-id/ I'm too lazy to look it up now, but such a function had been offered in VB-DOS already.

However, in order to give a correct answer, use PowerShell:
[attachment 1961 Ashampoo_Snap_2016.05.03_07h38m06s_001_.png]

The PowerShell command line looks like (start PowerShell as an administrator)

Get-WmiObject Win32_PhysicalMedia | Format-Table Tag, SerialNumber

I'm sure, there's an API available, but WMI-APIs are traditionally very hard to understand and to handle properly, plus they largely depend on the Windows versions as well.

von GuenterP - am 03.05.2016 05:48
Hello Guenter

Yes, you are right. In the post from 2008 the "format" serial number was teamed with the MAC address to give a more substantial number.

Regards
Al

von Al - am 03.05.2016 05:53
Hi Al,

I believe, I found a method to retrieve the physical hardware serial number without digging too deep in the WMI part of Windows:

[attachment 1962 Ashampoo_Snap_2016.05.03_07h53m16s_002_.png]

You just have to execute the command

WMIC DISKDRIVE GET SERIALNUMBER > SERIAL.DAT

In the file SERIAL.DAT you will find the serial numbers of the hard disks of your system!
(Note: this will not allow for notations like ... > C:\MyDirecory\serial.dat, you have to change over to the chosen "current directory" before)

The "serial numbers" returned are not exactly those like you will get from calling the WMI system yourself. The three partions of the disk are shown as 2006...1 to 2006...3, the physical hard disk serial is 2006...0

If you want to get "real" untranslated serial numbers, even without WMI, then see project
http://www.codeproject.com/Articles/16941/Get-Physical-HDD-Serial-Number-without-WMI

Another project ..
http://www.codeproject.com/Articles/6077/How-to-Retrieve-the-REAL-Hard-Drive-Serial-Number

von GuenterP - am 03.05.2016 06:01
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.