The Confirm parameter instructs the command to which it is applied to stop processing before any changes are made. The command then prompts you to acknowledge each action before it continues. When you use the Confirm parameter, you can step through changes to objects to make sure that changes are made only to the specific objects that you want to change. This functionality is useful when you apply changes to many objects and want precise control over the operation of the Exchange Management Shell. A confirmation prompt is displayed for each object before the Exchange Management Shell modifies the object.
By default, the Exchange Management Shell automatically applies the Confirm parameter to cmdlets that have the following verbs:
-
Remove
-
Move
-
Stop
-
Clear
-
Suspend
-
Uninstall
-
Dismount
-
Disable
When a cmdlet runs that has any of these verbs, the Exchange Management Shell automatically stops the command and waits for your acknowledgement before it continues to process.
When you manually apply the Confirm parameter to a command, include the Confirm parameter at the end of the command, as in the following example:
Get-JournalRule | Enable-JournalRule -Confirm
When you run this example command, the following confirmation prompt is returned by the Exchange Management Shell:
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help
(default is "Y"):
The confirmation prompt gives you the following choices:
-
[Y] Yes Type Y to instruct the command to continue the operation. The next operation will present another confirmation prompt.
[Y] Yes is the default choice.
-
[A] Yes to All Type A to instruct the command to continue the operation and all subsequent operations. You will not receive additional confirmation prompts for the duration of this command.
-
[N] No Type N to instruct the command to skip this operation and continue with the next operation. The next operation will present another confirmation prompt.
-
[L] No to All Type L to instruct the command to skip this operation and all subsequent operations.
-
[S] Suspend Type S to pause the current pipeline and return to the command line. Type Exit to resume the pipeline.
-
[?] Help Type ? to display confirmation prompt help on the command line.
If you want to override the default behavior of the Exchange Management Shell and suppress the confirmation prompt for cmdlets on which it is automatically applied, you can include the Confirm parameter with a value of $False, as in the following example:
Get-JournalRule | Disable-JournalRule -Confirm:$False
In this case, no confirmation prompt is displayed.
Caution: |
|---|
The default value of the Confirm parameter is $True. The default behavior of the Exchange Management Shell is to automatically display a confirmation prompt. If you suppress this default behavior of the Exchange Management Shell, you instruct the command to suppress all confirmation prompts for the duration of that command. The command will process all objects that meet the criteria for the command without confirmation.
|
To display a list of cmdlets that accept the Confirm parameter, type the following command in the Exchange Management Shell:
Get-ExCommand | Where { $_.Definition -Like "*Confirm*" }