PowerShell Logo Small


This is the built-in help made by Microsoft for the command 'Get-Alias', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.


Gets the aliases for the current session.


Get-Alias [[-Name] [<String[]>]] [-Exclude [<String[]>]] [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable
[<System.String>]] [-Scope [<String>]] [<CommonParameters>]
Get-Alias [-Definition [<String[]>]] [-Exclude [<String[]>]] [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable
[<System.String>]] [-Scope [<String>]] [<CommonParameters>]

Search powershellhelp.space


The Get-Alias cmdlet gets the aliases (alternate names for commands and executable files) in the current session. This includes built-in aliases, aliases that you have set
or imported, and aliases that you have added to your Windows PowerShell profile.

By default, Get-Alias takes an alias and returns the command name. When you use the Definition parameter, Get-Alias takes a command name and returns its aliases.

Beginning in Windows PowerShell 3.0, Get-Alias displays non-hyphenated alias names in an "<alias> -> <definition>" format to make it even easier to find the information that
you need.



Online Version: http://go.microsoft.com/fwlink/p/?linkid=293964
Alias Provider




-------------------------- EXAMPLE 1 --------------------------

PS C:\>Get-Alias
CommandType Name

----------- ----

Alias % -> ForEach-Object

Alias ? -> Where-Object

Alias ac -> Add-Content

Alias asnp -> Add-PSSnapin

Alias cat -> Get-Content

Alias cd -> Set-Location

Alias chdir -> Set-Location

Alias clc -> Clear-Content

Alias clear -> Clear-Host

Alias clhy -> Clear-History …

This command gets all aliases in the current session.

The output shows the "<alias> -> <definition>" format that was introduced in Windows PowerShell 3.0. This format is used only for aliases that do not include hyphens,
because aliases with hyphens are typically preferred names for cmdlets and functions, rather than nicknames.

-------------------------- EXAMPLE 2 --------------------------

PS C:\>Get-Alias -Name g*, s* -Exclude Get-*

This command gets all aliases that begin with "g" or "s", except for aliases that begin with "get-".

-------------------------- EXAMPLE 3 --------------------------

PS C:\>Get-Alias -Definition Get-ChildItem

This command gets the aliases for the Get-ChildItem cmdlet.

By default, the Get-Alias cmdlet gets the item name when you know the alias. The Definition parameter gets the alias when you know the item name.

-------------------------- EXAMPLE 4 --------------------------

PS C:\>Get-Alias | Where-Object {$_.Options -Match "ReadOnly"}

This command retrieves all aliases in which the value of the Options property is ReadOnly. This command provides a quick way to find the aliases that are built into Windows
PowerShell, because they have the ReadOnly option.

Options is just one property of the AliasInfo objects that Get-Alias gets. To find all properties and methods of AliasInfo objects, type "Get-Alias | get-member".

-------------------------- EXAMPLE 5 --------------------------

PS C:\>Get-Alias -Definition "*-PSSession" -Exclude e* -Scope Global

This example gets aliases for commands that have names that end in "-PSSession", except for those that begin with "e".

The command uses the Scope parameter to apply the command in the global scope. This is useful in scripts when you want to get the aliases in the session.