Skip navigation
What is ConfirmPreference in PowerShell

What is ConfirmPreference in PowerShell

Q. What is $ConfirmPreference in PowerShell?

A. You may notice that sometimes in PowerShell you are prompted to confirm an action, other times you are not. Every cmdlet has an impact level which if its equal or higher than the $ConfirmPreference you will be prompted for confirmation. To view the current $ConfirmPreference just view the variable which should be High. If, for example, you set $ConfirmPreference to "Medium" you will be prompted when stopping processes but are not if the $ConfirmPreference is the default "High". Note that if you lower the $ConfirmPreference you can avoid the confirmation by adding -confirm:$false to the command. You can also set $ConfirmPreference to "None" to never get prompted for confirmation.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish