This is the built-in help made by Microsoft for the document 'about_Functions_Advanced', in PowerShell version 5 - as retrieved from
Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-24.
For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.
Introduces advanced functions that act similar to cmdlets.
Advanced functions allow you to write functions that can perform operations
that are similar to the operations you can perform with cmdlets. Advanced
functions are helpful when you want to quickly write a function without
having to write a compiled cmdlet using a Microsoft .NET Framework
language. These functions are also helpful when you want to restrict the
functionality of a compiled cmdlet or when you want to write a function
that is similar to a compiled cmdlet.
There is a difference between authoring a compiled cmdlet and an advanced
function. Compiled cmdlets are .NET Framework classes that must be written
in a .NET Framework language such as C#. In contrast, advanced functions
are written in the Windows PowerShell script language in the same way that
other functions or script blocks are written.
Advanced functions use the CmdletBinding attribute to identify them as
functions that act similar to cmdlets. The CmdletBinding attribute is
similar to the Cmdlet attribute that is used in compiled cmdlet classes to
identify the class as a cmdlet. For more information about this attribute,
The following example shows a function that accepts a name and then prints
a greeting using the supplied name. Also notice that this function defines
a name that includes a verb (Send) and noun (Greeting) pair similar to the
verb-noun pair of a compiled cmdlet. However, functions are not required
to have a verb-noun name.
write-host ("Hello " + $Name + "!")
The parameters of the function are declared by using the Parameter
attribute. This attribute can be used alone, or it can be combined with
the Alias attribute or with several other parameter validation attributes.
For more information about how to declare parameters (including dynamic
parameters that are added at runtime), see
The actual work of the previous function is performed in the Process
block, which is equivalent to the ProcessingRecord method that is used by
compiled cmdlets to process the data that is passed to the cmdlet. This
block, along with the Begin and End blocks, is described in the
Advanced functions differ from compiled cmdlets in the following ways:
- Advanced function parameter binding does not throw an exception when
an array of strings is bound to a Boolean parameter.
- The ValidateSet attribute and the ValidatePattern attribute cannot
pass named parameters.
- Advanced functions cannot be used in transactions.
Windows PowerShell Cmdlets (http://go.microsoft.com/fwlink/?LinkID=135279)