Ask Question Forum:
Model Library:2025-02-08 Updated:A.I. model is online for auto reply question page
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
Asked by PeterDelphin
at 2024-07-28 12:05:09
Point:500 Replies:21 POST_ID:829142USER_ID:12034
Topic:
Computer Hard Drives;;
I am trying to get the HARDWARE Serial Numbers of hard-disk drives (which includes SSDs) with WMI (Windows Management Instrumentation):
Class: Win32_DiskDrive
Namespace: rootCIMV2
Now, a customer's computer contains 4 Western Digital hard-disk drives:
WDC WD2002FYPS-02W3B0 ATA Device
WDC WD2003FYYS-02W0B0 ATA Device
WDC WD3000GLFS-01F8U0 ATA Device
WDC WD30EZRX-00MMMB0 ATA Device
And these are the serial numbers of these 4 hard-disk drives I got with the above WMI query:
2020202057202d44435756413559323535303937
2020202057202d444d5759413030303834323931
2020202057202d445857354c3830353035313836
2020202057202d4443575741305a343930343730
Please note that these serial-numbers are very similar, so I cannot believe these are the real serial-numbers of these hard-disk drives.
So I used a professional hardware information program (HWiNFO) to compare these serial-numbers with those detected from HWiNFO, and they were totally different.
So I wonder whether it is possible to query the REAL hardware serial-numbers of hard-disk drives by using WMI?
Class: Win32_DiskDrive
Namespace: rootCIMV2
Now, a customer's computer contains 4 Western Digital hard-disk drives:
WDC WD2002FYPS-02W3B0 ATA Device
WDC WD2003FYYS-02W0B0 ATA Device
WDC WD3000GLFS-01F8U0 ATA Device
WDC WD30EZRX-00MMMB0 ATA Device
And these are the serial numbers of these 4 hard-disk drives I got with the above WMI query:
2020202057202d44435756413559323535303937
2020202057202d444d5759413030303834323931
2020202057202d445857354c3830353035313836
2020202057202d4443575741305a343930343730
Please note that these serial-numbers are very similar, so I cannot believe these are the real serial-numbers of these hard-disk drives.
So I used a professional hardware information program (HWiNFO) to compare these serial-numbers with those detected from HWiNFO, and they were totally different.
So I wonder whether it is possible to query the REAL hardware serial-numbers of hard-disk drives by using WMI?
Expert: Gerald Connolly replied at 2024-07-30 01:12:01
@peter, i was just trying to point out that in simple systems you may get the real Disk Serial number, but if the system is using RAID the OS may not even have access to the real Disks, it will only see the LUN presented by the RAID controller.
The serial number of this LUN will have been generated by the controller. NB Most controllers can do RAIDsets of 15 or more disks so they generate one. Is it going to be unique? Unlikely.
The serial number of this LUN will have been generated by the controller. NB Most controllers can do RAIDsets of 15 or more disks so they generate one. Is it going to be unique? Unlikely.
Expert: Rob Miners replied at 2024-07-29 15:28:00
If you only need the Serial Number and Hard drive identification try this I don't know if it will work on raid though as I can't test it.
wmic path win32_physicalmedia get SerialNumber, Tag
wmic path win32_physicalmedia get SerialNumber, Tag >%temp%SerialNumber.txt & start notepad %temp%SerialNumber.txt
I found it easier to combine two commands if you need the Model number.
wmic path win32_physicalmedia get SerialNumber, Tag & wmic diskdrive get model
wmic path win32_physicalmedia get SerialNumber, Tag >%temp%SerialNumber.txt & wmic diskdrive get model >>%temp%SerialNumber.txt & start notepad %temp%SerialNumber.txt
It produces similar output to your first post.
Note:
This command line works straight up in 8.1
C:WINDOWSsystem32>wmic diskdrive get name, serialnumber, model
Model Name SerialNumber
ST2000DM001-9YN164 ATA Device \.PHYSICALDRIVE0 W1F1D6Y0
ST31000528AS ATA Device \.PHYSICALDRIVE1 9VP8QB51
The same command line in Windows 7 produces the serial number in string format:
C:Windowssystem32>wmic diskdrive get name, serialnumber, model
Model Name SerialNumber
ST2000DM001-9YN164 ATA Device \.PHYSICALDRIVE0 202020202020202020202020315a304531563331
wmic path win32_physicalmedia get SerialNumber, Tag
wmic path win32_physicalmedia get SerialNumber, Tag >%temp%SerialNumber.txt & start notepad %temp%SerialNumber.txt
I found it easier to combine two commands if you need the Model number.
wmic path win32_physicalmedia get SerialNumber, Tag & wmic diskdrive get model
wmic path win32_physicalmedia get SerialNumber, Tag >%temp%SerialNumber.txt & wmic diskdrive get model >>%temp%SerialNumber.txt & start notepad %temp%SerialNumber.txt
It produces similar output to your first post.
Note:
This command line works straight up in 8.1
C:WINDOWSsystem32>wmic diskdrive get name, serialnumber, model
Model Name SerialNumber
ST2000DM001-9YN164 ATA Device \.PHYSICALDRIVE0 W1F1D6Y0
ST31000528AS ATA Device \.PHYSICALDRIVE1 9VP8QB51
The same command line in Windows 7 produces the serial number in string format:
C:Windowssystem32>wmic diskdrive get name, serialnumber, model
Model Name SerialNumber
ST2000DM001-9YN164 ATA Device \.PHYSICALDRIVE0 202020202020202020202020315a304531563331
Author: PeterDelphin replied at 2024-07-29 13:29:05
Gerald Connolly wrote: "Doesnt sound like a good plan. Disks change a lot, and some RAID controllers (probably all) give made up serial numbers, probably the same one on all systems.
I would of thought something like the MAC address would be a better bet?"
Oh come on, let this be my problem. The main topic here (as stated in the question title) is how to get the serial number, either with WMI or other API.
I would of thought something like the MAC address would be a better bet?"
Oh come on, let this be my problem. The main topic here (as stated in the question title) is how to get the serial number, either with WMI or other API.
Expert: Gerald Connolly replied at 2024-07-29 13:15:42
Doesnt sound like a good plan. Disks change a lot, and some RAID controllers (probably all) give made up serial numbers, probably the same one on all systems.
I would of thought something like the MAC address would be a better bet?
I would of thought something like the MAC address would be a better bet?
Author: PeterDelphin replied at 2024-07-29 08:45:04
I am a software developer. I need it to get a unique hardware ID for licensing purposes, and the hard-disk drive serial number is part of that.
Expert: Gerald Connolly replied at 2024-07-29 03:53:37
Why do you need the serial numbers?
Expert: duncanb7 replied at 2024-07-29 00:46:16
I don't have such API,
To answer your question post, WMIC can not get the hard disk serial number.
Duncan
To answer your question post, WMIC can not get the hard disk serial number.
Duncan
Author: PeterDelphin replied at 2024-07-29 00:41:32
So is there any other reliable API (as asked in my question title) to get the serial-number of hard-disk drives?
Expert: duncanb7 replied at 2024-07-28 23:23:57
Great work, wmic is wrong on my laptiop and yours, and you also proved it from hardware. Probably is wmic 's issue but the testing sample is small. I will create new thread for asking who will be interested to test wmic on window for serial number to collect more statistic information that not just prove hw32 correct but also WMIC incorrect
Duncan
Duncan
Author: PeterDelphin replied at 2024-07-28 23:19:16
It's like I suspected: The serial numbers printed on the hardware are the same as I got from HWiNFO.
So the numbers from wmic are clearly wrong.
So the numbers from wmic are clearly wrong.
Author: PeterDelphin replied at 2024-07-28 15:02:19
OK, will try it tomorrow morning.
Expert: duncanb7 replied at 2024-07-28 14:06:31
Could we mount off the disk drive and read the serial number on back side of the disk provided from manufacturer ? If possible, that will know which tools is more accurate. My computer is laptop that is hard to mount or take it off.
Duncan
Duncan
Expert: duncanb7 replied at 2024-07-28 13:56:50
And model number all correct on WMIC, HW32, HDD_ID
Expert: duncanb7 replied at 2024-07-28 13:55:09
I also check your tools (hw32) and other internet tools on my driver all are same serial and is different from
wmic but it is strange the number is closer to similar and just swap between integer in the number
for example,
HDD_ID reports WD-WXR1EB0TWS04
HW32 reports WD-WXR1EB0TWS04
WMIC reports W -DXW1RBET0SW40
You may be right. But Microsoft is huge company. How do you think to trust which one ?
Duncan
wmic but it is strange the number is closer to similar and just swap between integer in the number
for example,
HDD_ID reports WD-WXR1EB0TWS04
HW32 reports WD-WXR1EB0TWS04
WMIC reports W -DXW1RBET0SW40
You may be right. But Microsoft is huge company. How do you think to trust which one ?
Duncan
Author: PeterDelphin replied at 2024-07-28 13:51:48
BTW, have you tried it yourself on your own computer and compared to the serial number in HWiNFO?
Author: PeterDelphin replied at 2024-07-28 13:49:53
Here is the result:
2020202057202d44435756413559323535303937
2020202057202d444d5759413030303834323931
2020202057202d445857354c3830353035313836
2020202057202d4443575741305a343930343730
2020202057202d44435756413559323535303937
2020202057202d444d5759413030303834323931
2020202057202d445857354c3830353035313836
2020202057202d4443575741305a343930343730
Expert: duncanb7 replied at 2024-07-28 13:31:23
the serialnumber in your post seems size number for two disks
please try it one more
wmic diskdrive get serialnumber
Duncan
please try it one more
wmic diskdrive get serialnumber
Duncan
Author: PeterDelphin replied at 2024-07-28 13:19:02
Here is the result of the command:
Caption=WDC WD2002FYPS-02W3B0 ATA Device
DeviceID=\.PHYSICALDRIVE1
Model=WDC WD2002FYPS-02W3B0 ATA Device
Partitions=3
Size=2000396321280
Caption=WDC WD2003FYYS-02W0B0 ATA Device
DeviceID=\.PHYSICALDRIVE2
Model=WDC WD2003FYYS-02W0B0 ATA Device
Partitions=1
Size=2000396321280
Caption=WDC WD3000GLFS-01F8U0 ATA Device
DeviceID=\.PHYSICALDRIVE3
Model=WDC WD3000GLFS-01F8U0 ATA Device
Partitions=2
Size=300066439680
Caption=WDC WD30EZRX-00MMMB0 ATA Device
DeviceID=\.PHYSICALDRIVE4
Model=WDC WD30EZRX-00MMMB0 ATA Device
Partitions=0
Size=3000590369280
Caption=WDC WD2002FYPS-02W3B0 ATA Device
DeviceID=\.PHYSICALDRIVE1
Model=WDC WD2002FYPS-02W3B0 ATA Device
Partitions=3
Size=2000396321280
Caption=WDC WD2003FYYS-02W0B0 ATA Device
DeviceID=\.PHYSICALDRIVE2
Model=WDC WD2003FYYS-02W0B0 ATA Device
Partitions=1
Size=2000396321280
Caption=WDC WD3000GLFS-01F8U0 ATA Device
DeviceID=\.PHYSICALDRIVE3
Model=WDC WD3000GLFS-01F8U0 ATA Device
Partitions=2
Size=300066439680
Caption=WDC WD30EZRX-00MMMB0 ATA Device
DeviceID=\.PHYSICALDRIVE4
Model=WDC WD30EZRX-00MMMB0 ATA Device
Partitions=0
Size=3000590369280
Expert: duncanb7 replied at 2024-07-28 13:08:29
Could you try this on command line
wmic diskdrive list brief /format:list
to see any different ?
Duncan
wmic diskdrive list brief /format:list
to see any different ?
Duncan
Author: PeterDelphin replied at 2024-07-28 12:50:06
These are the serial-numbers I get from HWiNFO:
Drive Serial Number: WD-WCAVY5520579
Drive Serial Number: WD-WMAY00802419
Drive Serial Number: WD-WXL508051568
Drive Serial Number: WD-WCAWZ0944007
Meanwhile I've also checked with another hardware information tool: These from HWiNFO are correct.
Drive Serial Number: WD-WCAVY5520579
Drive Serial Number: WD-WMAY00802419
Drive Serial Number: WD-WXL508051568
Drive Serial Number: WD-WCAWZ0944007
Meanwhile I've also checked with another hardware information tool: These from HWiNFO are correct.
Expert: duncanb7 replied at 2024-07-28 12:43:32
What is serial number you get from (HWiNFO) ? Could you send it us for comparsion ?
Duncan
Duncan