The Alias attribute
Like CmdletBinding
, the Alias
attribute may be placed preceding the param
block. It may be used before or after CmdletBinding
; the ordering of attributes does not matter.
The Alias
attribute is used to optionally create aliases for a function. A function can have one or more aliases; the attribute accepts either a single value or an array of values. For example, you can create an alias gsm
for the function Get-Something
via the following attribute:
function Get-Something {
[CmdletBinding()]
[Alias('gsm')]
param ( )
}
The body of a function may use named blocks, such as begin
, process
, and end
, to control how code executes.