Tutorial by Examples

function myFunction { param( # If parameter 'a' is used, then 'c' is mandatory # If parameter 'b' is used, then 'c' is optional, but allowed # You can use parameter 'c' in combination with either 'a' or 'b' # 'a' and 'b' cannot be used together [p...
When you want for example enforce the use of the parameter Password if the parameter User is provided. (and vise versa) Function Do-Something { Param ( [Parameter(Mandatory=$true)] [String]$SomeThingToDo, [Parameter(ParameterSetName="Credentials", man...
Function Do-Something { Param ( [Parameter(Mandatory=$true)] [String]$SomeThingToDo, [Parameter(ParameterSetName="Silently", mandatory=$false)] [Switch]$Silently, [Parameter(ParameterSetName="Loudly", mandatory=$false)] ...

Page 1 of 1