In this Friday post, I will show you how to create and use aliases in PowerShell and make your life a bit easier when dealing with repeatable cmdlets.
You probably don’t know it but many of the cmdlets that you are using With PowerShell are actually Aliases. The reason PowerShell is using Aliases is to short the cmdlets. Let’s take for example the cls cmdlet, this cmdlet clear the screen. cls is an alias of the clear-host. go ahead and check it using the following cmdlet.
To view all the PowerShell aliases on PowerShell 7, type the following cmdlet, and you will be surprised how many cmdlets are aliases.
To create an alias use the following cmdlet, in my case when I type time I will get the time and date which will be an alias to the get-date cmdlet.
Set-Alias time get-date
To remove an alias, use the following cmdlet.