October 29th, 2012

PowerTip: Find PowerShell Aliases for Cmdlets from a Specific Module

Doctor Scripto
Scripter

Summary: See how to find all Windows PowerShell aliases for cmdlets and functions exposed by a specific module.

Hey, Scripting Guy! Question How can I find all of the aliases defined for commands (functions or cmdlets) in a specific module?

        Hey, Scripting Guy! Answer Use the Get-Command cmdlet (gcm is alias) to return all the commands from the module, and then use the Get-Alias cmdlet (gal is alias) to look for aliases with a definition of the command name.

gcm -Module *utility* | % {gal -Definition $_.name -ea 0}

Note   *utility* is a wildcard pattern for the Microsoft.PowerShell.Utility module.

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.

Feedback