Powershell Needful Things put that in your pipeline

28Jan/116

Automatic Custom Mailbox Limits

Posted by Jean Louw

This little script runs through the Exchange mailboxes and reads the current mailbox size, and sets a new warning limit and send limit for each mailbox, based on the current size.

So basically it looks at the current size of the mailbox, and sets a warning, at current size + 250MB and a send limit, at current size + 350MB. This was a quick workaround for us in an unmanaged environment to quickly establish some method of control without granting over sized limits, in order to accommodate large mailboxes.

This scripts should be run from the Exchange Management Shell.

The code can be copied from here:

$boxes = get-mailbox -resultsize unlimited | Get-MailboxStatistics

Foreach ($box in $boxes)
    {
        $name = $box.DisplayName
        $currentSize = $box.TotalItemSize.ToString().Split("(")[1].Split(" ")[0].Replace(",", "")
        $WarningQuota = ([int]$currentSize + 262144000)
        $SendQuota = ([int]$currentSize + 367001600)

        Set-Mailbox -Identity $name -IssueWarningQuota $WarningQuota -ProhibitSendQuota $SendQuota
    }
28Jan/116

Repair Exchange mailbox display name case

Posted by Jean Louw

We had a problem at one of our customers, where the users were created (by someone else :)) in ALL CAPS. This is more of an annoyance that anything else so I wrote a little script to read the names, and set the case from UPPER CASE to Proper Case.

You obviously have to run this from the Exchange Management Shell.

You can copy the code for the script from here:

$mailboxes = Get-Mailbox

foreach ($mbx in $mailboxes)
    {
        write "..currenntly processing:" $mbx.Name
        $oldName = $mbx.Name.ToString().Split(' ')
        $newName = ($oldName | foreach {$_.Substring(0,1) + $_.SubString(1).ToLower()})
       
        $mbx | set-mailbox -name $newName -displayname $newName
    }