list full partition information from powershell, just like from Disk Management
Solution 1:
The following code snippet would list all properties of all volumes, each particular volume together with corresponding partition:
Get-Volume | ForEach-Object {
$VolObj = $_
$ParObj = Get-Partition | Where-Object { $_.AccessPaths -contains $VolObj.Path }
if ( $ParObj ) {
$VolObj | Select-Object -Property *
'------------'
$ParObj | Select-Object -Property *
'----------------------------------'
}
}
Try combining desired properties in a custom object or simply to standard output e.g. as
PS C:\Windows\system32> Get-Volume | ForEach-Object {
$VolObj = $_
$ParObj = Get-Partition | Where-Object { $_.AccessPaths -contains $VolObj.Path }
if ( $ParObj ) {
'{0,2} {1,2} {2,6} {3,20} {4,20} {5,2} {6}' -f $VolObj.DriveLetter,
$ParObj.DiskNumber,
$VolObj.FileSystem,
$VolObj.Size,
$VolObj.SizeRemaining,
$ParObj.PartitionNumber,
$VolObj.FileSystemLabel
}
}
D 0 NTFS 1000202039296 900793958400 1 DataDisk
1 NTFS 366997504 83173376 1 Rezervováno systémem
C 1 NTFS 119664537600 69979885568 2