Overview of Windows PowerShell 5.0

  • 11/2/2015

Supplying options for cmdlets

One of the useful features of Windows PowerShell is the standardization of the syntax in working with cmdlets. This vastly simplifies the learning of Windows PowerShell and language constructs. Table 1-1 lists the common parameters. Keep in mind that some cmdlets cannot implement some of these parameters. However, if these parameters are used, they will be interpreted in the same manner for all cmdlets, because the Windows PowerShell engine itself interprets the parameters.

TABLE 1-1 Common parameters

Parameter

Meaning

-WhatIf

Tells the cmdlet to not execute, but to tell you what would happen if the cmdlet were to run.

-Confirm

Tells the cmdlet to prompt before executing the command.

-Verbose

Instructs the cmdlet to provide a higher level of detail than a cmdlet not using the verbose parameter.

-Debug

Instructs the cmdlet to provide debugging information.

-ErrorAction

Instructs the cmdlet to perform a certain action when an error occurs. Allowed actions are Continue, Ignore, Inquire, SilentlyContinue, Stop, and Suspend.

-ErrorVariable

Instructs the cmdlet to use a specific variable to hold error information. This is in addition to the standard $Error variable.

-OutVariable

Instructs the cmdlet to use a specific variable to hold the output information.

-OutBuffer

Instructs the cmdlet to hold a certain number of objects before calling the next cmdlet in the pipeline.