Powershell – Optional Credential (@Splatting)

Simon St-DenisPowershell0 Comments

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 *