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 7 quick reference

To

Do this

Display help for a command that is missing a parameter

Use the HelpMessage parameter property.

Make a parameter mandatory

Use the Mandatory parameter property in the param section of the function.

Implement -verbose in a function

Use the [cmdletbinding] attribute and write the messages via the Write-Verbose cmdlet.

Implement the -whatif switched parameter in a function

Use the [cmdletbinding()] attribute with the SupportsShouldProcess property.

Ensure that only defined parameters pass values to the function

Use the [cmdletbinding()] attribute.

Group sets of parameters for ease of use and checking

Create a parameter set via the ParameterSetName parameter property.

Assign a specific position to a parameter ...

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