Author Posts

January 1, 2012 at 12:00 am

by curtissw at 2013-01-17 09:21:36

I am trying to script deleting email from certain folders in a users mailbox and we are already using the polices for something eals and you canonly have one. I have everthing working if I run it manually but I can not automate it because it requires user input and I just need to hit the enter key. Is there a way to do this in powershell? In the old daye I would just pipe in a arrage return. A copy of the main parts of this scrpt is below.

$today = (get-date).AddDays(-14).ToString("MM/dd/y")
Export-Mailbox -Identity “general" -IncludeFolders "\001” -EndDate “$today" –DeleteContent

by DonJ at 2013-01-17 15:36:46

Are you experiencing a confirmation prompt, you mean? You're being asked to hit Yes or No? In that case, try adding -Force if the command supports it, or -Confirm], or both if supported.

by curtissw at 2013-01-29 11:07:04

The -Confirm:$false option worked.

I thought that I tried that option but I must have typo it and it’s not listed as an available option so I may not have.

Thanks again for your response!