- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to use function Alias in PowerShell?
Like the Parameter alias, we can also set the function alias name to refer to the function as a different name.
Example
function Test-NewConnection{ [CmdletBinding()] [Alias("TC")] param( [Parameter(Mandatory=$true)] [String]$Server ) Write-Output "Testing $server connection" }
Now, instead of the Test-NewConnection function name, you can directly use the function alias “TC” as shown below.
PS C:\> Tc -Server "Test1-win2k16" Testing Test1-win2k16 connection
- Related Articles
- How to use an alias() for the parameter in PowerShell?
- How to create PowerShell alias permanently?
- How to create new alias with PowerShell?
- How to overwrite or remove PowerShell alias?
- How to use the ValidateRange attribute in PowerShell function?
- How to use the ValidateSet Attribute in PowerShell function?
- How to use the ValidateScript attribute in PowerShell function?
- How to use the ValidateCount attribute in PowerShell Function?
- What is an alias in PowerShell?
- How to use an Alias in MySQL calculations?
- How to use alias in MySQL select query?
- How to get/resolve the command from the alias in PowerShell?
- When to Use an Alias vs Script vs a New Function in Bash
- How to use stopwatch in PowerShell?
- How to use PowerShell as a Calculator? Or How to use PowerShell for arithmetic operations?

Advertisements