Need command to take the default option
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!
You must be logged in to reply to this topic.