I know I can get the serial number of all listed hard drives by using:

wmic diskdrive list brief

or specifically

wmic diskdrive get serialnumber

And I can get the drive letter from the logical disk:

wmic logicaldisk list brief

or specifically

wmic logicaldisk get deviceid

But how do I correlate the drive letter (logicaldisk DeviceID) with the physical disk ID (diskdrive DeviceID)? I'd like to do this from command line in a batch file if at all possible.


3 Answers 3


You can find GUID of disk using diskpart:

Start>run>cmd>diskpart>list disk and check for GPT

Start>run>cmd>diskpart>list disk>select disk> uniqueid disk and check for disk ID

You could also use the command mountvol C:/ /L to obtain the GUID of this partition.

  • Thanks. I am trying to automate it. If I provide the drive letter, I want to be able to get the serial number.
    – HTWingNut
    May 5, 2021 at 21:32

I found a solution for that, if anyone needs it in the future:

Get-Partition -DriveLetter "C" | Get-Disk | Select-Object Serialnumber | ForEach {$_.SerialNumber}

This select the partition "C" and use the Get-Disk too get the serial number and then it select the object with serial number. Since there's only one object the ForEach will give you the serial number only!

It cost me a while to get this working, hope this will save some people some hours of their life time...


Since your solution is for PowerShell, here is another way to get it for all Disks at once:

GWMI -namespace root\cimv2 -class win32_volume | FL -property DriveLetter, DeviceID, SerialNumber
  • Which solution ?
    – Toto
    May 5 at 13:46
  • The serial number this outputs is the volume's serial number, not the hard drive's Sep 4 at 1:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .