Se você quiser apenas unidades físicas, é tão fácil quanto
PS> Get-PhysicalDisk
FriendlyName SerialNumber MediaType CanPool OperationalStatus HealthStatus Usage Size
------------ ------------ --------- ------- ----------------- ------------ ----- ----
Generic USB SD Reader x Unspecified False OK Healthy Auto-Select 14.49 GB
Samsung SSD 840 PRO Series xxxxxxxxxxxxxxx SSD True OK Healthy Auto-Select ...47 GB
ST2000DL003-9VT166 xxxxxxxx HDD False OK Healthy Auto-Select 1.82 TB
ASMT 2105 xxxxxxxxxxxxxxxxxxxx Unspecified False OK Healthy Auto-Select ...51 GB
se você quiser a cadeia de associações isso poderia ajudar
$diskdrive = gwmi win32_diskdrive
foreach($drive in $diskdrive){
out-host -InputObject "'nDrive: deviceid-$($drive.deviceid.substring(4)) Model - $($drive.model)"
##partition
$partitions = gwmi -Query "ASSOCIATORS OF {Win32_DiskDrive.DeviceID='"$($drive.DeviceID.replace('\','\'))'"} WHERE AssocClass = Win32_DiskDriveToDiskPartition"
foreach($part in $partitions){
Out-Host -InputObject "'tPartition: $($part.name)"
$vols = gwmi -Query "ASSOCIATORS OF {Win32_DiskPartition.DeviceID='"$($part.DeviceID)'"} WHERE AssocClass = Win32_LogicalDiskToPartition"
foreach($vol in $vols){
out-host -InputObject "'t't$($vol.name)"
}
}
}
Exemplo de saída
Drive: deviceid-PHYSICALDRIVE0 Model - ST2000DL003-9VT166
Partition: Disk #0, Partition #0
D:
Drive: deviceid-PHYSICALDRIVE1 Model - Samsung SSD 840 PRO Series
Partition: Disk #1, Partition #0
H:
Partition: Disk #1, Partition #1
C:
Partition: Disk #1, Partition #2
Drive: deviceid-PHYSICALDRIVE2 Model - Generic USB SD Reader USB Device
Partition: Disk #2, Partition #0
I:
Drive: deviceid-PHYSICALDRIVE3 Model - ASMT 2105 USB Device
Partition: Disk #3, Partition #0