Finding Aliases for PowerShell Cmdlet Parameters

Many PowerShell cmdlet parameters have aliases such as “Cn” for ComputerName. These aliases aren’t well documented and even viewing the full help for a cmdlet doesn’t show them. The following command can be used to display a list of all the parameters for a particular PowerShell cmdlet and any aliases that exist for those parameters:

One thing to keep in mind is this is a list of all the parameters from all parameter sets which means some of them are mutually exclusive and can’t be used with one another.

If you only want to display the parameters that have aliases, add the Where-Object cmdlet to the command and test to see if aliases is true:

Here’s a parameterized script with a mandatory parameter for the cmdlet name and an optional parameter for the parameter name:

Running the script without at least specifying the mandatory parameter will prompt for it. Specifying only a cmdlet name returns all parameters and any aliases that exist for them:

Specifying the cmdlet and parameter name only returns that particular parameter and the aliases for it if any exist:

Update 08/30/12
The full help in PowerShell version 3 does show parameter aliases. The aliases for a specific parameter can be viewed using Help CmdletName -Parameter ParameterName:


1 Comment

  1. boymeetskeyboard

    Thanks for this Mike, really useful, keep coming back to this as I continue to play with pipes and prod at powershell.

    Since seeing this (& info on commands with pipelineinput parameters), I’ve been building queries to try see ALL commands with these.

    Have made progress recently in this stupid proof-of-concept, utilizing scriptblocks to reference ‘parent’ commands, stored in variables.

    After constructing the valid query re ALL commands with pipelineinputs

    Get-Command * -CommandType Cmdlet | %{ $cName = $_.Name; Get-Help $cName -Parameter * -ErrorAction SilentlyContinue | where {$_.pipelineInput -like ‘true*’} | Select Name, PipelineInput, {$cName} }

    I’ve looked at pipelinevairables and outvariables, which may be required for my last silly query:
    Get any UNIQUE parameter aliases, on any commands…

    Do I need to store the entire output as a variable, to sort -unique?

    I’ve discovered how to pass OR conditions to a NOTMATCH filter, to exclude ALL listed, removing common_parameters like ErrorAction & ErrorVariable, but would like a UNIQUE list, sorted by parameter name… currently don’t think I can do this as am in a foreach…

    Stupid question! but how would you sort these into a unique list?!

    Get-Command * -CommandType Cmdlet -ErrorAction SilentlyContinue -OutVariable cParam | % {$cName = $_.Name; $cParam.Parameters.Values | where aliases | sort $cName | where {$_.Name -notmatch “ErrorAction|ErrorVariable|Confirm|InformationAction|InformationVariable|WarningAction|WarningVariable|OutBuffer|OutVariable|WhatIf|LiteralPath|PipelineVariable|Debug|Verbose|Credential”} | select {$cName}, name, aliases}



Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: