O'Reilly logo

Windows PowerShell™ 3.0 Step by Step by Ed Wilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6 quick reference

To

Do this

Create a function

Use the Function keyword, and provide a name and a script block.

Reuse a Windows PowerShell function

Dot-source the file containing the function.

Constrain a data type

Use a type constraint in square brackets and place it in front of the variable or data to be constrained.

Provide input to a function

Use the Param keyword and supply variables to hold the input.

To use a function

Load the function into memory.

To store a function

Place the function in a script file.

To name a function

Use Get-Verb to identify an appropriate verb and use the verb-noun naming convention.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required