Change Mailbox quota in a bulk.

I'm trying to get all users that use mailboxes less than 0.5GB and set them to 0.5GB. By default all new mailboxes are set to 2GB.

get-mailbox -ResultSize unlimited|Get-MailboxStatistics | Where {$_.TotalItemSize -lt 0.5GB}

Where : Cannot compare "984.1 MB (1,031,912,881 bytes)" to "536870912" because the objects are not the same type or the object "984.1 MB (1,031,912,881

bytes)" does not implement "IComparable".

At line:1 char:59

+ get-mailbox -ResultSize unlimited|Get-MailboxStatistics | Where {$_.TotalItemSiz ...

+                                                           ~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Where-Object], ExtendedTypeSystemException

    + FullyQualifiedErrorId : PSObjectCompareTo,Microsoft.PowerShell.Commands.WhereObjectCommand


  • Edited by pTomic 19 hours 4 minutes ago
May 26th, 2015 8:26am

 

I you want to get the mailboxes less than 512MB please use this

get-mailbox -ResultSize unlimited|Get-MailboxStatistics | Where {$_.TotalItemSize -lt 512MB}

If you want to set them individual quota  to 512MB whose mailbox is less than 512MB. Please use this which will set issue warning quota to 512MB prohibit send quota to 550MB and Prohibit send and receive quota to 600MB 

foreach ($i in (get-mailbox | Get-MailboxStatistics | Where {$_.TotalItemSize -lt 512MB})){Set-Mailbox -Identity $i -IssueWarningQuota 536870912 -ProhibitSendQuota 576716800 -ProhibitSendReceiveQuota 629145600 -UseDatabaseQuotaDefaults $false}

Use this command to verify

get-mailbox | where {$_.UseDatabaseQuotaDefaults -eq $False} | ft name,prohibit*,issue*

Thanks, MAS
Please mark as helpful if you find my comment helpful or as an answer if it does answer your question. That will encourage me - and others - to take time out to help you.



Free Windows Admin Tool Kit Click here and download it now
May 26th, 2015 8:58am

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

Other recent topics Other recent topics