- foreach ($Drive in Get-WmiObject win32_diskDrive )
{
foreach ($Partition in gwmi -query ('associators of {win32_diskdrive.deviceid="'+$Drive.deviceid.replace('\','\\')+'"} where assocclass = win32_diskDriveToDiskPartition'))
{
foreach ($Disk in gwmi -query ('associators of {win32_diskpartition.deviceid="'+$Partition.deviceID+'"} where assocclass = win32_logicalDiskToPartition'))
{
write-host "$($Disk.DeviceID)*$($Disk.FileSystem)*$($Drive.caption)*$($Disk.Size)_$($Drive.Size)*$($Disk.VolumeName)*$($Partition.name)*$($Partition.BootPartition) "
}
}
}