Avoiding the Confirm prompt in scripts

There are two ways you can suppress confirmation from a script or console:

1. Set the automatic variable to ‘None’ or 0 in your
$ConfirmPreference = ‘None’

cd Variable:
then dir to see all the variables currently defined in your shell, the text above will change the behavior though, and then at the end of your script you could change it back to ‘High’

2. Pass $false to the Cmdlet’s -Confirm switch

-confirm:$false

Windows PowerShell blog on this topic:  http://blogs.msdn.com/b/powershell/archive/2006/12/15/confirmpreference.aspx

Windows PowerShell blog home:  http://blogs.msdn.com/b/powershell/