Sadece fiziksel sürücüler istiyorsanız, bu kadar kolay
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
Eğer askerler zincirini istiyorsanız, bu yardımcı olabilir
$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)"
}
}
}
Örnek çıktı
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
Get-WMIObject -Class Win32_LogicalDisk -Property * | Select-Object -First 1 | Get-Member
hem ilginç hem de kullanışlı bulabilirsiniz.