PowerShell for Windows Admins

Jan 15 2010   3:49PM GMT

Mapping physical disks to logical drives

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

We have looked at physical disks and logical disks. We know there is a relationship between them.

disk drive – partition – logical disk

In WMI this maps to.

Win32_DiskDrive – Win32_DiskPartition – Win32_LogicalDisk.DeviceID

We have two classes that provide the links

Win32_DiskDriveToDiskPartition and Win32_LogicalDiskToPartition which we can use like this

Get-WmiObject -Class Win32_DiskDriveToDiskPartition | Select Antecedent, Dependent

Get-WmiObject -Class Win32_LogicalDiskToPartition | Format-List Antecedent, Dependent

but we then have to match the information ourselves.  if we look at the information for the C: drive

Antecedent : \\RSLAPTOP01\root\cimv2:Win32_DiskDrive.DeviceID="\\\\.\\PHYSICALDRIVE0"
Dependent  : \\RSLAPTOP01\root\cimv2:Win32_DiskPartition.DeviceID="Disk #0, Partition #1"

Antecedent : \\RSLAPTOP01\root\cimv2:Win32_DiskPartition.DeviceID="Disk #0, Partition #1"
Dependent  : \\RSLAPTOP01\root\cimv2:Win32_LogicalDisk.DeviceID="C:"

we can see that we get antecedent and dependent pairs – we can access these associations directly using a WQL query to find the ASSOCIATORS.

PS> Get-WmiObject -Query "ASSOCIATORS OF {Win32_DiskDrive.DeviceID=’\\.\PHYSICALDRIVE0′} " | Select __CLASS -Unique


Shows us that we have a direct association between the Win32_DiskDrive class and the Win32_DiskPartition class. Next we have to work out how to get this information for all drives and all partitions

Technorati Tags: ,,

 Comment on this Post

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: