We recently rolled out a new Retention Policy in my Exchange 2016 environment but I only wanted it to apply to Linked and User Mailboxes; not Shared or Resource Mailboxes.
We'll set a different policy for those. So I needed a way to apply this new Policy to a certain mailbox type. We'll get this done quickly with PowerShell!
Generally, when you apply a Retention Policy in bulk you would run Get-Mailbox | Set-Mailbox without any filters, and that would apply it to all Mailboxes in the organization.
We don't want that, so we'll use a filter to grab the Mailbox Type.
Fire up the Exchange Management Shell and run the following cmdlet:
Get-Mailbox -Filter {(RecipientTypeDetails -eq 'UserMailbox')} | Set-Mailbox –RetentionPolicy "UserMailbox Retention Policy"
The above cmdlet will apply your policy named "UserMailbox Retention Policy" to User Mailboxes only.
Since this is a Resource Forest, I also have Linked Mailboxes in my environment. So we'll need to apply the Policy to those as well:
Get-Mailbox -Filter {(RecipientTypeDetails -eq 'LinkedMailbox')} | Set-Mailbox –RetentionPolicy "UserMailbox Retention Policy"
This cmdlet will filter only Linked Mailboxes and apply the "UserMailbox Retention Policy"
**Note** Change "UserMailbox Retention Policy" to the name of your policy.
If you have multiple policies for different mailbox types, change the RecipientTypeDetails -eq 'mailboxtype' to one of the following:
UserMailbox
LinkedMailbox
SharedMailbox
RoomMailbox
EquipmentMailbox
For instance, setting a Room Mailbox Policy would look like so:
Get-Mailbox -Filter {(RecipientTypeDetails -eq 'RoomMailbox')} | Set-Mailbox –RetentionPolicy "RoomMailbox Retention Policy"
Now your different mailbox types will have the proper policies applied!
No comments:
Post a Comment