I have this query which scans all logical disks information :
Write-Host "Drive information for $env:ComputerName"
Get-WmiObject -Class Win32_LogicalDisk |
Where-Object {$_.DriveType -ne 5} |
Sort-Object -Property Name |
Select-Object Name, VolumeName, VolumeSerialNumber,SerialNumber, FileSystem, Description, VolumeDirty, `
@{"Label"="DiskSize(GB)";"Expression"={"{0:N}" -f ($_.Size/1GB) -as [float]}}, `
@{"Label"="FreeSpace(GB)";"Expression"={"{0:N}" -f ($_.FreeSpace/1GB) -as [float]}}, `
@{"Label"="%Free";"Expression"={"{0:N}" -f ($_.FreeSpace/$_.Size*100) -as [float]}} |
Format-Table -AutoSize
The output is :
However - I'm after the physical disks information and their partitions / volume information :
So - for physical disks I have this command :
Get-Disk
Result :
Question :
I want to combine between those 2 commands . I want to see the Disk , and below each disk - its logical disk information :
- Disk Number 1 : ....(info)
>
Its logical disks info.....
- Disk Number 2 : ....(info)
>
It's logical disks info.....
- Disk Number 3 : ....(info)
>
It's logical disks info.....
- etc...
How can I combine between those 2 queries ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…