Powershell Best Practice #19: Check parameters with PSBoundParameters

By | September 9, 2015

Best Practice: You should use the automatic variable $PSBoundParameters instead of just specifying the variable name.

Explanation: The automatic variable $PSBoundParameters is a hashtable containing the parameters passed to a script or a function

By using the $PSBoundParameters, you avoid some possible confusion or unexpected behaviour, and also make the code clearer.


previous-buttonnext-button

Leave a Reply

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