PowerShell Functions

When we need to use the same code in more than one script, then we use a PowerShell function.

function is a list of PowerShell statements whose name is assigned by the user. When we execute a function, we type the name of a function.

Like the cmdlets, functions can also have parameters. The function parameters can be read from the pipeline or from the command line.

In PowerShell, functions return the values that can be assigned to the variables or passed to the cmdlets or other functions. By using the return keyword, we can specify the return value.


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *