Skip to main content This browser is no longer supported. Show
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support. about_CommonParameters
In this articleShort descriptionDescribes the parameters that can be used with any cmdlet. Long descriptionThe common parameters are a set of cmdlet parameters that you can use with any cmdlet. They're implemented by PowerShell, not by the cmdlet developer, and they're automatically available to any cmdlet. You can use the common parameters with any cmdlet, but they might not have an effect on all cmdlets. For example, if a cmdlet doesn't generate any verbose output, using the Verbose common parameter has no effect. The common parameters are also available on advanced functions that use the CmdletBinding attribute or the Parameter attribute. Several common parameters override system defaults or preferences that you set by using the PowerShell preference variables. Unlike the preference variables, the common parameters affect only the commands in which they're used. For more information, see about_Preference_Variables. The following list displays the common parameters. Their aliases are listed in parentheses.
The Action parameters are ActionPreference type values. ActionPreference is an enumeration with the following values:
You may use the name or the value with the parameter. In addition to the common parameters, many cmdlets offer risk mitigation parameters. Cmdlets that involve risk to the system or to user data usually offer these parameters. The risk mitigation parameters are:
Common parameter descriptions-DebugDisplays
programmer-level detail about the operation done by the command. This parameter works only when the command generates a debugging message. For example, this parameter works when a command contains the
By default, debugging messages aren't displayed because the value of the In interactive mode, the Debug parameter overrides the value of the In non-interactive mode, the Debug parameter overrides the value of the
-ErrorActionDetermines how
the cmdlet responds to a non-terminating error from the command. This parameter works only when the command generates a non-terminating error, such as those from the
The ErrorAction parameter overrides the value of the The ErrorAction parameter has no effect on terminating errors (such as missing data, parameters that aren't valid, or insufficient permissions) that prevent a command from completing successfully.
Note The ErrorAction parameter overrides, but does not replace the value of the -ErrorVariableErrorVariable stores error messages about the command in the specified variable and in the
By default, new error messages overwrite error messages that are already stored in the variable. To append the error message to the variable content, type a plus sign ( For example, the following command creates the
The following command adds any error messages to the
The following command displays the contents of
You can use this parameter to create a variable that contains only error messages from specific commands and does not affect the behavior of the Note The custom error variable contains all errors generated by the command, including errors from calls to nested functions or scripts. -InformationActionIntroduced in PowerShell 5.0. Within the command or script in which it's used, the InformationAction common parameter overrides the value of the
Note The InformationAction parameter overrides, but does not replace the value of the -InformationVariableIntroduced in PowerShell 5.0. Within the command or script in which it's used, the InformationVariable common parameter stores in a variable a string that you specify by adding the Note The information variable contains all information messages generated by the command, including information messages from calls to nested functions or scripts.
-OutBufferDetermines the number of objects to accumulate in a buffer before any objects are sent through the pipeline. If you omit this parameter, objects are sent as they're generated.
This resource management parameter is designed for advanced users. When you use this parameter, PowerShell sends data to the next cmdlet in batches of The
following example alternates displays between to
-OutVariableStores output objects from the command in the specified variable in addition to sending the output along the pipeline.
To add the output to the variable, instead of replacing any output that might already be stored there, type a plus sign ( For example, the following command creates the
The following command adds the process object to the
The following command displays the contents of the
Note The variable created by the OutVariable parameter is a -PipelineVariablePipelineVariable allows access to the most recent value passed into the next pipeline segment by the command that uses this parameter. Any command in the pipeline can access the value using the named PipelineVariable. The value is assigned to the variable when it is passed into the next pipeline segment. This makes the PipelineVariable easier to use than a specific temporary variable, which might need to be assigned in multiple locations. Unlike Note Advanced functions can have up to three script blocks:
Valid values are strings, the same as for any variable names. Caution The PipelineVariable is scoped to the pipeline in which it is invoked. Variables outside the pipeline, which use same name, are cleared before the pipeline is executed. The PipelineVariable goes out of scope when the pipeline terminates. If multiple commands within the pipeline specify the same PipelineVariable then there is only one shared variable. That variable is updated with the most recent piped output from the command that specifies the variable. Some blocking commands collect all the pipeline items before producing any output, for example The following is an example of how PipelineVariable works. In this
example, the PipelineVariable parameter is added to a The results of the first
-VerboseDisplays detailed
information about the operation done by the command. This information resembles the information in a trace or in a transaction log. This parameter works only when the command generates a verbose message. For example, this parameter works when a command contains the
The Verbose parameter overrides the value of the
-WarningActionDetermines how the cmdlet responds to a warning from the command. Continue is the default value. This parameter works only when the command generates a warning message. For example,
this parameter works when a command contains the
The WarningAction parameter overrides the value of the
Note The WarningAction parameter overrides, but does not replace the value of the -WarningVariableStores warnings about the command in the specified variable.
All generated warnings are saved in the variable even if the warnings aren't displayed to the user. To append the warnings to the variable content, instead of replacing any warnings that might already be stored there, type a plus sign ( For example, the
following command creates the
The following command adds any warnings to the
The following command displays the contents of
You can use this parameter to create a variable that contains only warnings from specific commands. You can use array notation, such as Note The warning variable contains all warnings generated by the command, including warnings from calls to nested functions or scripts. Risk Management Parameter Descriptions-WhatIfDisplays a message that describes the effect of the command, instead of executing the command.
The WhatIf parameter overrides the value of the
For example, the following command uses the
Instead of removing the item, PowerShell lists the operations it would do and the items that would be affected. This command produces the following output:
-ConfirmPrompts you for confirmation before executing the command.
The Confirm parameter overrides the value of the
For example, the
following command uses the Confirm parameter with a
The Confirm response options are as follows:
The Suspend option places the command on hold and creates a temporary nested session in which you can work until you're ready to choose a Confirm option. The command prompt for the nested session has two extra carets (>>) to indicate that it's a child operation of the original parent command. You can run commands and scripts in the nested session. To end the nested session and return to the Confirm options for the original command, type "exit". In the following example, the Suspend option (S) is used to halt a command temporarily while the user checks the help for a command parameter. After obtaining the needed information, the user types "exit" to end the nested prompt and then selects the Yes (y) response to the Confirm query.
Keywordsabout_Common_Parameters See also
FeedbackSubmit and view feedback for Which of the Splunk command generates temporary search results?Use outputcsv or outputlookup when you need to create a temporary or short-term storage of data.
Which command can be used in Splunk to further filter results in a search?filter. The filter command lets you further filter the logs retrieved in the search results.
What are the commands in Splunk?List of search commands. What is the most efficient way to limit search results returned Splunk?Using time to limit the events returned is the most efficient way to filter events. The less data you have to search, the faster Splunk will be. After time, the default fields of index, source, host, and sourcetype are the most powerful.
|