Hello,
I have what should be a simple request, but have been having issues getting this to work. I have a request to delete everything from a shared mailbox except drafts every 5 mins. This is a shared mailbox using a shared windows login in a conference room. Our mgmt wants to make sure everything sent from the mailbox, is deleted, so that any confidential info is not accessabile to the next meeting's attendees.
In Exchange 2007, we created a schedule task to call a .ps1 script to do this
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin
Export-Mailbox -identity "shared mailbox" -IncludeFolders "\Sent Items" -DeleteContent -Confirm:$False -Globalcatalog "GC name"
This worked perfectly. Trying to replicate this on 2013 doesn't seem to be as easy. Since the export-mailbox command does not seem to be valid anymore, i have the search-mailbox command below. This does what we want when ran directly from EMS.
Search-Mailbox -Identity "shared mailbox" -SearchQuery 'from:"shared mailbox"' –DeleteContent -force
When trying to create a scheduled task, i can't get this command to run. I created a new task with an action of start a program, and start powershell. I have the arguments below. This is not working. Any ideas on the best way to schedule the search-mailbox command above to run every 5 mins?
-command ". 'D:\Program Files\Microsoft\Exchange Server\V15\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; 'd:\path to script'"
Any ideas on the best way to schedule the search-mailbox command above to run every 5 mins? Please let me know if any other info would be helpful.