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 (for your functions) than the native one parameter of the builtin Powershell cmdlets.


If you create a function which takes as a parameter a computerName, you should use the name : ComputerName
Why “ComputerName”? Because many builtin cmdlets use this parameter name so you should follow this standard.

powershell use same params native ones

However, you can use alias to handle these non-native parameters names (ex: Server, Computer, etc.)

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.


Leave a Reply

Your email address will not be published.