Powershell New-Item: How to Accept Confirmation Automatically

Viewed 50264

I'm trying to create a new directory on a network drive using a powershell script but it keeps prompting me

"Confirm: Are you sure you want to perform this action ...."

Is there a way to override this so it doesn't ask me since I'm running this script from a web interface.

Here is my call:

New-Item $rollbackDirectory -type Directory -Force

It does the same thing, with or without the -Force parameter

I've also tried this format with no luck

New-Item -name $rollbackName -itemtype directory -path $rollbackdrive -Debug -Force
2 Answers
Related