Chapter4/4.6_AdvancedFunctions/4.6.2_Parameter/ParameterPosition.ps1
function Get-DirectorySize { [CmdletBinding()] param( [parameter(Position=1)] [string]$LiteralPath, [parameter(Position=0)] [int]$OverSize ) process { $measure = Get-ChildItem -LiteralPath $LiteralPath -Recurse -Force -File | Measure-Object -Sum Length $output = [pscustomobject]@{ Path = $LiteralPath FileCount = $measure.Count Sum = $measure.Sum OverSize = $measure.Sum -ge $OverSize } Write-Output $output } } |