Powershell Best Practice #17: Use the same parameter name than the native one

By | August 4, 2015

Best Practice: It is recommended to use the same name for your parameter (of your function for example) than the native one parameter of Powershell.

If you create a cmdlet which takes as a parameter a computerName, so you should use the name : ComputerName

Indeed, for example the native cmdlet “Test-Connection” use this parameter :

Test-Connection -ComputerName

Explanation: It is useful to improve the readability and the understanding, if your parameter looks like a native one, there is no possible confusion.

If you call your parameter “PC” or “Comp”, it is less clear.


previous-buttonnext-button

2 thoughts on “Powershell Best Practice #17: Use the same parameter name than the native one

  1. Pingback: Powershell Best Practice #18: Don’t use Notepad as a script editor | Powershell Guru

  2. Pingback: Powershell Best Practice #16: Update the help | Powershell Guru

Leave a Reply

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