Site icon Franky's Web

Exchange 2010: Configure managed folders with retention policies

There have already been a few questions on the subject of managed folders. Therefore, here is a short article on how to create managed folders and configure retention policies.

In Exchange 2010 SP3, managed folders and their policies can be created with the Exchange Management Shell. The aim of this howto is to create a managed folder "Private Mails" and assign a policy to the folder that deletes the contents of the folder after 90 days.

First, a new managed folder is created:

New-ManagedFolder -name „Private Mails“ -FolderName „Private Mails“

The "Private Mails" folder is then displayed in Outlook and OWA (I had a small problem with the display, more on this in a moment)

Now you can define which restrictions should apply to the contents of the folder

New-ManagedContentSettings „Private Mails“ -AgeLimitForRetention 90 -RetentionEnabled $true -RetentionAction DeleteAndAllowRecovery -FolderName 8d5c3038-2984-47bc-b0a6-96fab58ffcdb -messageclass *

AgeLimitforRetention" defines the maximum age of the content, "Retentionaction" defines what should happen to the content when the 90 days have expired. "MessageClass" specifies the type of content, in this case any type. As "FolderName" I enter the GUID of the folder and not the name, as I had the problem that Exchange could not find the folder otherwise, and at first the folder was not displayed in the mailbox. We'll get to fixing the error in a moment. The GUID of the folder can be set with

Get-ManagedFolder | ft name,guid

display. Now we need a policy for the mailbox, this is created with

New-ManagedFolderMailboxPolicy -name „Private Mails Richtlinie“ -ManagedFolderLinks „Private Mails“

created. The policy can now be bound to the mailboxes:

set-mailbox frank -ManagedFolderMailboxPolicy „Private Mails Richtlinie“

or for all mailboxes

get-mailbox –resultsize unlimited | set-mailbox -ManagedFolderMailboxPolicy „Private Mails Richtlinie“

The screenshot shows the sequence of commands once again:

Now, as already mentioned, I had the problem that the folder was not displayed in the mailbox. The following error message could be found in the event log:

The problem could be solved by restarting the service "Microsoft Exchange Mailbox Assistant" and executing the command "start-managedfolderassistant frank".

Finally, we need a schedule in which the mailbox assistant runs through the mailboxes and deletes old mails. In this example, it runs daily between 23:00 and 05:00:

Get-MailboxServer | Set-MailboxServer -ManagedFolderAssistantSchedule „Monday.11:00 PM-Tuesday.05:00 AM“,“Tuesday.11:00 PM-Wednesday.05:00 AM“,“Wednesday.11:00 PM-Thursday.05:00 AM“,“Thursday.11:00 PM-Friday.05:00 AM“,“Friday.11:00 PM-Saturday.05:00 AM“

Done! For Exchange 2013, I'll submit it later.

Exit mobile version