Powershell – Optional Credential (@Splatting)

Simon St-DenisPowershellLeave a Comment

Powershell Splatting

Splatting is a way to sendĀ a collection of parameters to a command of a function. By creating a array that contains both the name of the parameter and the value. Here is a exemple of a classic splatting.

 

Splatting become very useful when the number of parameters is not always the same.

Let’s use it for passingĀ optional credential to a function. This is a complete standalone script.

 

Leave a Reply

Your email address will not be published. Required fields are marked *