PowerShell

PowerShell: Parameters cheat sheet

Very quick examples of possible PS parameters Function Test-Parameters { [CmdletBinding(SupportsShouldProcess=$True, ConfirmImpact=”High”, DefaultParameterSetName=”Folder”)] Param ( [Parameter(Position=0,HelpMessage=”Some help tip”,Manatory,ParameterSetName=’Set1′)] [string]$Foo, [Parameter(ValueFromPipeline, ValueFromPipelineByPropertyName)] [string[]]$Bar, [ValidateSet(“Allowed1″,”Allowed2”)] $Whatever, [ValidateScript({Test-Path $_ -PathType ‘Container’})] [int]$Make, [ValidateRange(21,65)] [Int]$Age ) Begin{} Process{} End{} }