Tip: Since PowerShell v3, you can define parameter attributes without the equal sign operator.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# Powershell v2 function Get-Something { Param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [string[]]$ComputerName ) } # Powershell v3, 4 and 5 function Get-Something { Param ( [Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)] [string[]]$ComputerName ) } |