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 the new shell and language. Table 1-1 lists the common parameters. Keep in mind that all cmdlets will not implement these parameters. However, if these parameters are used, they will be interpreted in the same manner for all cmdlets because it is the Windows PowerShell engine itself that interprets the parameter.

Table 1-1: Common Parameters
Open table as spreadsheet

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, stop, silentlyContinue, and inquire.

-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

Note 

To get help on any cmdlet, use the Get-Help cmdletname cmdlet.




Microsoft Press - Microsoft Windows PowerShell Step by Step
MicrosoftВ® Windows PowerShell(TM) Step By Step (Step By Step (Microsoft))
ISBN: 0735623953
EAN: 2147483647
Year: 2007
Pages: 128
Authors: Ed Wilson

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net