An alias is an alternate name that invokes a PowerShell command. Console aliases can save typing, but scripts should favor full command and parameter names so shared code remains readable. section 17.1.1 section 18.2
Use aliases differently depending on where the code will live:
- Use console shortcuts when speed matters and the command is only for you. section 18.2
- Avoid ambiguous or obscure aliases in scripts; spell out commands such as Get-Service, Invoke-Command, and Get-WmiObject. section 18.6
- Use tab completion to enter full names with less effort and reduce spelling mistakes. section 18.2
Parameter aliases
Advanced functions can assign several alternate names to one parameter. A parameter declared as [Alias('CN','MachineName','Name')] [string[]]$ComputerName accepts -CN, -MachineName, -Name, or the canonical -ComputerName. section 11.1.4
[CmdletBinding()]
Param(
[Parameter(ValueFromPipeline=$True,
Mandatory=$True)]
[Alias('CN','MachineName','Name')]
[string[]]$ComputerName,
[string]$LogFailuresToPath,
[ValidateSet('Wsman','Dcom')]
[string]$Protocol = "Wsman",
[switch]$ProtocolFallback
)
Inspect a complete advanced-function parameter block combining a parameter alias with pipeline input, validation, and a switch parameter. section 11.1.4





