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 Tuesday, May 26, 2015 12:25 PM
May 26th, 2015 12:25pm

 

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 12:57pm

One more question how to get users that have  mailboxes between 512MB and 1024Mb to set their mailboxes to 1024MB ?

P.S.

Where : Cannot compare "984.4 MB (1,032,251,478 bytes)" to "536870912" because the objects are not the same type or the object "984.4 MB (1,032,251,478 bytes)" does not

implement "IComparable".

At line:1 char:40

+ (get-mailbox | Get-MailboxStatistics | Where {$_.TotalItemSize -lt 512MB})

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

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

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

  • Edited by pTomic 21 hours 22 minutes ago
May 28th, 2015 5:26am

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

Other recent topics Other recent topics