PowerShell Confirm Preference

I seem to run into an issue when I run some PowerShell scripts where I get prompted at each line of the script for confirmation.  That can get really annoying, so I have to look up how to prevent that behavior.  Thankfully, there is already some good information out there on how to do that:

When confirmation is turned on by $ConfirmPreference, you can turn it off for any individual cmdlet invocation using "-Confirm:$false".  You can also use "-Confirm:$false" to turn off default confirmation for high impact cmdlets such as Removing a Mailbox.  Another way to turn off confirmation is by setting $ConfirmPreference to "None"; you can limit the effect by setting $script:ConfirmPreference etc, see "get-help about_scope" for more details.

For more details and options besides just turning it off, go see the original post:

Windows PowerShell Blog : ConfirmPreference

Leave a Reply