How To: Change mailbox quota based on current value

This turns out to be somewhat tricky unless you experiment quite a lot with the values and operators, therefore I'm posting the quick solution here for those of you that (like me) like to find what you search for... :o)

If you use the Get-Mailbox cmdlet without parameters you will get all mailboxes listed in a table view like this:

Name Alias ServerName ProhibitSendQuota
----- ----- ---------- -----------------
John Doe JohnDoe Server01 50MB
Jane Doe JaneDoe Server01 unlimited

So suppose you want to change the ProhibitSendQuota for all users that currently have a quota of 50MB to 100MB; in my mind the straight forward way to find all users with a 50MB quota would be to apply the filter: ProhibitSendQuota -eq 50MB but that will return exactly nothing...

Instead you have to use sizes like Exchange do (although Get-Mailbox returns the formatted output). So bearing in mind that 50MB in Exchange terms is 50 x 1024 = 51200 the string will look like this:

Get-Mailbox -Filter { ProhibitSendQuota -like 51200 } | Set-Mailbox -ProhibitSendQuota 100MB -UseDatabaseQuotaDefaults $false

Notice that you have to use "-like" instead of "-eq" which would be the more logical operator to use in this case. When setting the new size you can use KB, MB, GB, TB as you please...

The above will look like this in the GUI:

 GUI screenshot

Enjoy...