How ConfirmPreference works

by Mar 22, 2010

Cmdlet authors can judge how severe the action is a cmdlet takes and choose from Low over Medium to High. You can use the variable $ConfirmPreference to set the level at which you would like to be warned before a cmdlet actually does something.

By default, this variable is set to High, so any cmdlet with an impact level of high will ask before it actually runs, much like if you had manually used the Confirm parameter. By setting $ConfirmPreference to Medium, you will then be warned when using cmdlets with an impact level of Medium or above.

Twitter This Tip! ReTweet this Tip!