Do not prompt when writing to output file in DPM PowerShell

2017-12-04T11:47:55+00:00 April 14th, 2011|PowerShell|

Just a quick one for anyone else that uses a DPM PowerShell command to output to a file and keeps getting prompted to perform the action:

image

If you are writing anything that has a for each clause in there then you can end up typing “Y” for each time it wants to write to the file.

All you need to do is add in the following option at the end of your line:

-confirm:$false

So the example command from above would read:

“What you want to output” | out-file “c:outputfile.txt” -confirm:$false

The file should then overwrite without prompting.

Paul