267 questions
Can't you find the identifier using Get-WmiObject Win32_DiskDrive?
Hereby example of a script?
Get-WmiObject Win32_DiskDrive | ForEach-Object {
$disk = $_
$partitions = "ASSOCIATORS OF {Win32_DiskDrive.DeviceID='$($disk.DeviceID)'} WHERE AssocClass=Win32_DiskDriveToDiskPartition"
Get-WmiObject -Query $partitions | ForEach-Object {
$partition = $_
$logicalDisks = "ASSOCIATORS OF {Win32_DiskPartition.DeviceID='$($partition.DeviceID)'} WHERE AssocClass=Win32_LogicalDiskToPartition"
Get-WmiObject -Query $logicalDisks | ForEach-Object {
[PSCustomObject]@{
DiskModel = $disk.Model
DeviceID = $disk.DeviceID
Volume = $_.DeviceID
Partition = $partition.DeviceID
PNPDeviceID = $disk.PNPDeviceID
}
}
}
}