If you wish to obtain the model number and serial number for a hard disk drive (HDD) from the command line on a Microsoft Windows system, you can use the Windows Management Instrumentation command line tool
wmicat a command prompt or
get-wmiobject -class win32_diskdrivefrom a Windows PowerShell prompt.
For wmic, you can use the following command:
C:\Users\JDoe\Documents>wmic diskdrive get caption, model, serialnumber Caption Model SerialNumber TOSHIBA MQ01ABD075 TOSHIBA MQ01ABD075 73RISBDFS Seagate Backup+ Desk USB Device Seagate Backup+ Desk USB Device NA5J4H3R
In the above example, I also included the
parameter to get a description for the drive that may help me more
easily identify it, though in this case the caption information and the
model information are the same. In the above case, the Toshiba drive
is the internal drive in the system while the Seagate is an external,
To use PowerShell to obtain the same information, I could use the command below:
PS C:\Users\JDoe> get-wmiobject -class win32_diskdrive | format-table Caption, Model, SerialNumber Caption Model SerialNumber ------- ----- ------------ TOSHIBA MQ01ABD075 TOSHIBA MQ01ABD075 73RISBDFS Seagate Backup+ Desk USB Device Seagate Backup+ Desk USB Device NA5J4H3R
You can obtain much more information on drives in PowerShell with the
get-wmiobject -class win32_diskdrive | format-list * command.
If the drive supports
and Reporting Technology (SMART), you can use the
command to learn if the drive may be failing or is encountering problems that
could lead to a drive failue.
PS C:\Users\Jim> get-wmiobject -class win32_diskdrive | format-table Caption, Model, Status, SerialNumber Caption Model Status SerialNumber ------- ----- ------ ------------ TOSHIBA MQ01ABD075 TOSHIBA MQ01ABD075 Pred Fail 73RISBDFS Seagate Backup+ Desk USB D... Seagate Backup+ Desk USB D... OK NA5J4H3R
The Toshiba drive has a status of
Pred Fail, which indicates
a SMART-enabled hard disk may be functioning correctly, but a failure is
predicted soon. You can also retrieve the status of a drive using
the wmic command.
C:\Users\JDoe\Documents>wmic diskdrive get model, status, serialnumber Model SerialNumber Status TOSHIBA MQ01ABD075 73RISBDFS Pred Fail Seagate Backup+ Desk USB Device NA5J4H3R OK
Other parameters you can use with wmic to obtain drive information, such as the capacity of the drive, etc., are listed at Using wmic to get disk drive information.
A PowerShell command that can be used to determine which drive the operating system considers to be drive zero, drive one, etc. is shown below:
PS C:\Users\JDoe> Get-WmiObject Win32_PhysicalMedia | Format-Table Tag, SerialNumber Tag SerialNumber --- ------------ \\.\PHYSICALDRIVE0 73RISBDFS \\.\PHYSICALDRIVE1 NA5J4H3R \\.\CDROM1 \\.\CDROM0
Physical disk status is not OK
Microsoft Developer Network
Disk Drive Dangers - SMART and WMI
I Programmer - programming, reviews and projects
Using wmic to get disk drive
Date: July 10, 2010