What is PowerShell Alias?
- Alias is an alternate name that can be created for any Windows PowerShell cmdlet.
- Windows PowerShell also has predefined built-in aliases for certain cmdlets.
- The following cmdlets are used to work with alias:
- Get-Alias
- New-Alias
- Set-Alias
PowerShell Alias Cmdlets:
Get-Alias
Highlights: Returns a list of all Windows PowerShell aliases(Built-in and User-Defined). It can also return aliases depending on specific parameters.
Demo steps:
Step 1: The Get-Alias cmdlet displays all the aliases.

Step 2: The -Name parameter can be used to retrieve a list of aliases that starts with a specific name. The below example displays all the aliases starting with w or W (case insensitive).

Step 3: Definition parameter is used to retrieve the aliases of a particular cmdlet.

New-Alias
Highlights: Used to create a new alias for cmdlets in Windows PowerShell.Cannot be used to re-assign an existing alias to another cmdlet.
Demo steps:
Step 1: In the below example, an alias named ‘commands’ is created for the Get-Command cmdlet.

Step 2: New-Alias cmdlet cannot be used to assign an already existing alias to another cmdlet. If we try to assign ‘commands’ to Get-Host cmdlet, it will throw an error as shown below.

Step 3: Aliases created using the New-Alias cmdlet are not saved after you exit the Windows PowerShell session.
Set-Alias
Highlights: Reassigns an existing alias to a different cmdlet, unlike New-Alias.Creates an alias for a cmdlet if the alias name does not exist.
Demo steps:
Step 1: Using the Set-Alias cmdlet, the alias ‘commands’ will now be referring to the Get-Host cmdlet instead of Get-Command.

Step 2: The Set-Alias cmdlet will create a new alias named ‘Host’ for the Get-Host cmdlet if the alias does not already exist.

Step 3: Set-Alias cannot assign an in-built alias to another cmdlet.

You need daily practice to master these powershell cmdlets.
Source : Microsoft
Continue Learning:
You’ll also like:
- Transfer Files Between Windows & Linux Machine Using PowerShell
- An Introduction to VMware PowerCLI
- Disable Clipboard Redirection Multiple Servers PowerShell
- How To Get Free Linux Terminal For 30 Minutes
- How To Check System Uptime in Both Windows and Linux Machine