Supplying Options for Cmdlets

As you have seen in the previous sections, you can use -whatif and -confirm to control the execution of cmdlets. One question students often ask me is, "How do I know what options are available?" The answer is that the Windows PowerShell team created a set of standard options. These standard options are called common parameters. When you look at the syntax description for a cmdlet, often it will state that the cmdlet supports the common parameters. This is shown here for the Get-Process cmdlet:

SYNTAX
    Get-Process [[-name] <string[]>] [<CommonParameters>]

    Get-Process -id <Int32[]> [<CommonParameters>]

    Get-Process -inputObject <Process[]> [<CommonParameters>]

One of the useful features of Windows PowerShell is the standardization ...

Get Windows PowerShell™ Scripting Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.