Trouble setting up a managed folder policy to purge deleted items
I am on exchange 2010 sp1 standard and just need to set up a managed folder policy to purge all deleted items for all users after 90 days. What commands do I need to run in the shell to do this? I have spent lots of time trying to find the correct commands needed but seem to be just running in circles. Thanks for your help Matt W
June 15th, 2011 4:15pm

First create the managed content settings: New-ManagedContentSettings -Name 'Delete After 90 Days' -FolderName 'Deleted Items' -MessageClass '*' -AgeLimitForRetention 90 -RetentionAction DeleteAndAllowRecovery -RetentionEnabled:$True Next, create a policy to apply the settings: New-ManagedFolderMailboxPolicy -Name '90-Day Cleanup' -ManagedFolderLinks 'Delete After 90 Days' Apply the policy to all mailboxes: Get-Mailbox | Set-Mailbox -ManagedFolderMailboxPolicy '90-Day Cleanup' -ManagedFolderMailboxPolicyAllowed:$True Finally, schedule the policy to run (on Sunday in this example): Get-MailboxServer | Set-MailboxServer -ManagedFolderAssistantSchedule 'Sun.00:00-Sun.17:00' Of course read up on these commands and on the process itself to be sure that this is exactly what you want, and modify it accordingly.Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."
Free Windows Admin Tool Kit Click here and download it now
June 15th, 2011 5:39pm

Hi, Does Ed’s commands solve your issue? ThanksPlease remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
June 17th, 2011 5:27am

There was one line of syntax that was incorrect. I was off last week on vacation but will get back on it this week. ThanksMSI IT Dept
Free Windows Admin Tool Kit Click here and download it now
June 27th, 2011 6:17pm

First create the managed content settings: New-ManagedContentSettings -Name 'Delete After 90 Days' -FolderName 'Deleted Items' -MessageClass '*' -AgeLimitForRetention 90 -RetentionAction DeleteAndAllowRecovery -RetentionEnabled:$True Next, create a policy to apply the settings: New-ManagedFolderMailboxPolicy -Name '90-Day Cleanup' -ManagedFolderLinks 'Delete After 90 Days' This line didnt work. Instead of managefolderlinks i had to do -managedfolder 'deleted items' Apply the policy to all mailboxes: Get-Mailbox | Set-Mailbox -ManagedFolderMailboxPolicy '90-Day Cleanup' -ManagedFolderMailboxPolicyAllowed:$True I specified only my mailbox here for testing reasons. Finally, schedule the policy to run (on Sunday in this example): Get-MailboxServer | Set-MailboxServer -ManagedFolderAssistantSchedule 'Sun.00:00-Sun.17:00' This went through after specifyiing server but the email did not delete in the 15 minute interval I specified. However if i do a start-managedfolderassistant on the specific mailbox it will manually run. Looks like we just need to figure out why the schedule isnt working and we are good to go. Of course read up on these commands and on the process itself to be sure that this is exactly what you want, and modify it accordingly. Ed Crowley MVP "There are seldom good technological solutions to behavioral problems." See bolded responses above. Thanks for the help so farMSI IT Dept
June 28th, 2011 12:19am

Is there any way to private message a user? I would like to let Ed know I have updated and re-opened the question.MSI IT Dept
Free Windows Admin Tool Kit Click here and download it now
June 28th, 2011 4:12pm

Sorry, I made a mistake transcribing a customer-specific instruction. In the future, when posting commands and reporting errors, post the exact commands you issue and the exact and complete error messages you receive. What you posted isn't a fifteen-minute interval, it's 17 hours! If you only gave it fifteen minutes, then it might not have had time to complete the job, so try giving it more time. Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."
June 28th, 2011 8:43pm

I didnt use your 17 hour schedule. Since I was only testing with my mailbox which only had a few past date deleted emails I figured 15 minutes was fine. I will let it run for 2 hours today and see what happens. This doesn't rely on any overnight maintenance by chance does it? MSI IT Dept
Free Windows Admin Tool Kit Click here and download it now
June 29th, 2011 9:27am

I believe that it is independent of store maintenance.Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."
June 29th, 2011 11:06am

Well it has been running for 1 hour and 50 minutes and still hasnt deleted anything. Here is everything I have done line by line. I changed the retention to 40 days instead of 90 btw. Also the mailbox I am testing with is adam.t New-ManagedContentSettings -Name 'Delete After 40 Days' -FolderName 'Deleted Items' -MessageClass '*' -AgeLimitForRetention 40 -RetentionAction DeleteAndAllowRecovery -RetentionEnabled:$True New-ManagedFolderMailboxPolicy -Name '40-Day Cleanup' -ManagedFolder 'Deleted items' Set-Mailbox -Identity 'adam.t' -ManagedFolderMailboxPolicy '40-Day Cleanup' -ManagedFolderMailboxPolicyAllowed:$True Set-MailboxServer -Identity 'svr-exchange' -ManagedFolderAssistantSchedule 'Wed.8:30-Wed.11:30' All commands went through fineMSI IT Dept
Free Windows Admin Tool Kit Click here and download it now
June 29th, 2011 11:30am

Do you see anything in the event log? http://technet.microsoft.com/en-us/library/bb310783.aspx Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."
June 29th, 2011 6:17pm

On Wed, 29 Jun 2011 15:19:34 +0000, Bender38 wrote: > > >Well it has been running for 1 hour and 50 minutes and still hasnt deleted anything. Here is everything I have done line by line. I changed the retention to 40 days instead of 90 btw. Also the mailbox I am testing with is adam.t > > > >New-ManagedContentSettings -Name 'Delete After 40 Days' -FolderName 'Deleted Items' -MessageClass '*' -AgeLimitForRetention 40 -RetentionAction DeleteAndAllowRecovery -RetentionEnabled:$True > >New-ManagedFolderMailboxPolicy -Name '40-Day Cleanup' -ManagedFolder 'Deleted items' > >Set-Mailbox -Identity 'adam.t' -ManagedFolderMailboxPolicy '40-Day Cleanup' -ManagedFolderMailboxPolicyAllowed:$True > >Set-MailboxServer -Identity 'svr-exchange' -ManagedFolderAssistantSchedule 'Wed.8:30-Wed.11:30' IIRC, the 1st execution of the MRM doesn't do any deletion, it just prepares for subsequent executions. Go ahead and run a "start-managedfolderassistant -mailbox <mailboxname>" and see what happens. You should also look into the set-mailboxserver cmdlet and these parameters: -FolderLogForManagedFoldersEnabled -LogDirectorySizeLimitForManagedFolders -LogFileAgeLimitForManagedFolders -LogFileSizeLimitForManagedFolders -LogPathForManagedFolders Without a log file it's relly not possible to know what's going on. --- Rich Matheisen MCSE+I, Exchange MVP --- Rich Matheisen MCSE+I, Exchange MVP
Free Windows Admin Tool Kit Click here and download it now
June 29th, 2011 10:03pm

Rich, "start-managedfolderassistant -mailbox <mailboxname>" and see what happens. yeah this works fine. So I should just wait a week to make sure it runs? Ed, This is what I found in the event log Cmdlet suceeded. Cmdlet Set-MailboxServer, parameters {Identity=svr-exchange, ManagedFolderAssistantSchedule={Wed.8:30 AM-Wed.11:30 AM}}. ID 9017 Service MSExchangeMailboxAssistants. Managed Folder Mailbox Assistant for database Mailbox Database 1617637476 (942e301f-d583-48ca-9cd8-318f118f3133) is entering a work cycle. There are 98 mailboxes on this database. id 9018 Service MSExchangeMailboxAssistants. Managed Folder Mailbox Assistant for database Mailbox Database 1617637476 (942e301f-d583-48ca-9cd8-318f118f3133) reached a work cycle checkpoint (Duration: 23:45:23.1913376, Database Completely Healthy During Work Cycle: Yes). 98 mailboxes were successfully processed. 0 mailboxes were skipped due to errors. 0 mailboxes were processed separately. There are 0 mailboxes remaining on this database which will be processed during the next work cycles. edit: I noticed that the email is deleted now which is weird. Maybe I should get that logging turned on. MSI IT Dept
June 30th, 2011 10:30am

Thanks for the link. I don't see anything on the event log. :(Webmaster Forum | Webmaster Pride | Webmaster Forum
Free Windows Admin Tool Kit Click here and download it now
June 30th, 2011 6:36pm

On Thu, 30 Jun 2011 14:21:49 +0000, Bender38 wrote: >Rich, "start-managedfolderassistant -mailbox <mailboxname>" and see what happens. yeah this works fine. So I should just wait a week to make sure it runs? Or schedule it to run every 30 minutes until you satisfied that it's working and then use whatever schedule you're happy with. [ snip ] >edit: > >I noticed that the email is deleted now which is weird. Maybe I should get that logging turned on. Yes, you should. You can't manage what you can't measure. :-) --- Rich Matheisen MCSE+I, Exchange MVP --- Rich Matheisen MCSE+I, Exchange MVP
June 30th, 2011 8:35pm

Everything seems to be working great now but I have one last question Apply the policy to all mailboxes: Get-Mailbox | Set-Mailbox -ManagedFolderMailboxPolicy '90-Day Cleanup' -ManagedFolderMailboxPolicyAllowed:$True I am only able to apply this to one mailbox at a time. How do I apply it to the database or all mailboxes?MSI IT Dept
Free Windows Admin Tool Kit Click here and download it now
July 6th, 2011 1:59pm

On Wed, 6 Jul 2011 17:51:39 +0000, Bender38 wrote: > > >Everything seems to be working great now but I have one last question > > > >Apply the policy to all mailboxes: > >Get-Mailbox | Set-Mailbox -ManagedFolderMailboxPolicy '90-Day Cleanup' -ManagedFolderMailboxPolicyAllowed:$True > > > >I am only able to apply this to one mailbox at a time. How do I apply it to the database or all mailboxes? What you posted above would apply to the 1st 1,000 mailboxes (the "get-mailbox" with no further qualification would retrieve all the mailbox information from the AD but be restricted to using only the 1st 1,000). Add "-ResultSize unlimited" to have it apply to every mailbox in your organization. If "get-mailbox" only gets one mailbox then that's all the "set-mailbox" would get. --- Rich Matheisen MCSE+I, Exchange MVP --- Rich Matheisen MCSE+I, Exchange MVP
July 6th, 2011 5:53pm

Everything is working great. Thanks for all the helpMSI IT Dept
Free Windows Admin Tool Kit Click here and download it now
July 11th, 2011 11:06am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics