Chapter4/4.6_AdvancedFunctions/4.6.2_Parameter/ParameterMandatory.ps1
function Get-DirectorySize { [CmdletBinding()] param( [parameter(Mandatory=$true)] [string]$LiteralPath, [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 } } |