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.


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 '21 at 21:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.