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.
Explanation:
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.
1 2 3 4 5 6 |
# Recommended Get-InstalledProgram -ComputerName # Not recommended (because the name is not -ComputerName) Get-InstalledProgram -Computer Get-InstalledProgram -Server |
However, you can use alias to handle these non-native parameters names (ex: Server, Computer, etc.)
1 2 3 4 5 6 7 8 |
function Get-InstalledProgram { Param ( [Alias("Server", "Computer")] [string[]]$ComputerName ) } |
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.