Friday, April 29, 2011

PowerShell: Adjusting Configured Minimum Mailbox Quota

My new unit's Exchange environment had configured minimum mailbox quotas. Well they decided to up the range and we had to make sure all mailboxes were at least set the new minimum (which is this case was 500 MB).

#AD Setting for Multi Domain Forest
Set-ADServerSettings -ViewEntireForest $true

$mailboxes = get-mailbox -resultsize unlimited | select-object Name,Identity,ProhibitSendQuota,RecipientType,UseDatabaseQuotaDefaults

foreach ($mailbox in $mailboxes)
{
#Only Query User Mailboxes
if ($mailbox.RecipientType.ToString() -eq 'UserMailbox')
{

if ($mailbox.UseDatabaseQuotaDefaults -eq $false)
{
$quota = $mailbox.ProhibitSendQuota.Value.ToMB()

if($quota -lt 500)
{
#Write-Host $mailbox.Name.ToString()
set-mailbox -identity $mailbox.Identity -ProhibitSendQuota 500MB -IssueWarningQuota 475MB
}
}
}
}

Write-Host "All Done"

No comments: