# How to use an alias() for the parameter in PowerShell?

PowerShellMicrosoft TechnologiesSoftware & Coding

#### Powershell for beginners

15 Lectures 3.5 hours

#### Learning Task Automation using Windows PowerShell

35 Lectures 2.5 hours

#### The Complete PowerShell 7 course: Beginner To Advanced

Most Popular

145 Lectures 12.5 hours

PowerShell alias is a good way to use the shortcut name for the Parameter instead of writing the full name of the parameter. For example, you can refer to Server as ServerName, AppID as the ApplicationID.

So you don’t have to use the whole name of the parameter and it is easy to remember as well.

## Example

function Aliastest{
param(
[parameter(Mandatory=$true)] [Alias("Server")] [string]$ServerName
)
Write-Output "Server name is \$ServerName"
}

Now we can use the Server instead of ServerName while passing the arguments.

PS C:\> Aliastest -server "Test1-Win2k16"
Server name is Test1-Win2k16
Updated on 09-Nov-2020 09:33:23