param([ValidateSet('KB','GB','TB')]$SizeUnitName = 'GB') $local:zpool_cmd = $null $local:excludeType = '' $script:SizeUnit = Invoke-Expression "1$SizeUnitName" $script:SizeRound = 2 $SizeUnit /= 1KB function NewDataRow{param($Size,$Used,$Available,$Percent,$Source,$FSType,$Target) [PSCustomObject]@{ "Size$SizeUnitName" = [Math]::Round($Size /$SizeUnit, $SizeRound) "Used$SizeUnitName" = [Math]::Round($Used /$SizeUnit, $SizeRound) "Available$SizeUnitName" = [Math]::Round($Available/$SizeUnit, $SizeRound) 'Used%' = [int]($Percent -replace '%$','') Source = $Source FSType = $FSType Target = $Target } } $local:df = @() & df '--output=size,used,avail,pcent,source,fstype,target' | Select-Object -Skip 1 | ForEach-Object { $local:df = $_.Split(' ', [StringSplitOptions]::RemoveEmptyEntries) NewDataRow $df[0] $df[1] $df[2] $df[3] $df[4] $df[5] $df[6] } | Where-Object { -not ($_.FSType -eq 'zfs' -and $_.Source -match '/') } | Sort-Object -Property Target #$zpool_cmd = get-command zpool | Where-Object CommandType -eq 'Application' | Select-Object -ExpandProperty Source #if( $zpool_cmd ) { # $excludeType = '--exclude-type=zfs' #}