Quick Tip – Working with Mailboxes (Set-Mailbox)

QuickTip

I have come across this question many a times “When I want to set Quota on multiple mailboxes at a time using Set-Mailbox cmdlet, it works, but when I try some other option to be set on multiple mailbxoes it does not work” – Yes, this has always been the case, for many attributes like RecipientLimit you got to set them on per mailboxes basis.

Let us look at some example here to explain things better….

Objective 1: To set maximum Message Size for sending messages to 2 MB for all users in “Finance” OU

So how would you go about it, first thing first, find all mailboxes in Finance OU, the command would be Get-Mailbox -OrganizationalUnit “Finance”

Great now the logical step would be pipe the output to Set-Mailbox, here is how: Get-Mailbox -OrganizationalUnit “Finance” | Set-Mailbox -MaxSendSize 2097152

Voila you are done, all Mailboxes for Finance OU can now send mails with maximum size of 2 MB

Objective 2: To set Recipient Limit per messages to 5 for all users in “Finance” OU

Using the same logic as above example, this should work right Get-Mailbox -OrganizationalUnit “Finance” | Set-Mailbox -RecipientLimit 5

Yes, you got it, it didn’t work. Reason, well the Attribute MaxSendSize can be set on Multiple mailboxes at at time, where as RecipientLimit can only be set on a per mailbox basis. So what would be the solution for that, here it is

ForEach ($mbx in Get-Mailbox -OrganizationalUnit “Finance”) { Set-Mailbox $mbx -RecipientLimits 5 }

Click here for Set-Mailbox