- mode 160
-
- Get-PhysicalDisk | ForEach-Object {
- # Number FriendlyName SerialNumber MediaType CanPool OperationalStatus HealthStatus Usage Size
- Write-Host FriendlyName `t $_.FriendlyName
- Write-Host SerialNumber `t $_.SerialNumber
- Write-Host MediaType `t $_.MediaType
- Write-Host Size `t`t $_.Size`n`n
- }
-
- 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 = $_
- $drives = "ASSOCIATORS OF " +
- "{Win32_DiskPartition.DeviceID='$($partition.DeviceID)'} " +
- "WHERE AssocClass = Win32_LogicalDiskToPartition"
- Get-WmiObject -Query $drives | ForEach-Object {
- get-partition -DriveLetter $_.DeviceID.subString(0, 1) | get-disk
- Write-Host $_.DeviceID
- }
- }
- Write-Host $_.MediaType`n`n
- }
- Read-Host -Prompt "Press Enter to exit"
复制代码
|