5

I use the following command to delete the contents of a mailbox, but it still prompts me to confirm. Is there a way to not prompt me.

Search-Mailbox -id "UserName" -DeleteContent -Confirm:$false
JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
RPS
  • 1,401
  • 8
  • 19
  • 32

3 Answers3

4

The way to stop prompting is to use the -Force parameter (if the cmdlet supports it).

Setting -Confirm to $false just means "prompt me if you need to." Setting -Confirm to $true means "prompt me every time."

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
0

Simple thing just go through /Library/Mail/v2/MailData and delete the files with names Envelope then all the contents will be deleted from Mail App

flash
  • 6,730
  • 7
  • 46
  • 70
SURESH SANKE
  • 1,653
  • 17
  • 34
0

There seems to be a syntax error -confirm like -DeleteContent is a SwitchParameter this means that you just have to omit it.

Search-Mailbox -id "UserName" -DeleteContent 
JPBlanc
  • 70,406
  • 17
  • 130
  • 175