df -h > df_output.txt
$dfOutput = Get-Content -Path df_output.txt
$parsedOutput = $dfOutput | ForEach-Object { if ($_ -match '^\s*Filesystem\s+Size\s+Used\s+Avail\s+Use%\s+Mounted on') { return # Skip the header line } $parts = -split $_ [PSCustomObject]@{ Filesystem = $parts[0] Size = $parts[1] Used = $parts[2] Avail = $parts[3] UsePercent = $parts[4] MountedOn = $parts[5] } }
$parsedOutput | Format-Table -AutoSize