Exchange mailbox size output of more than 80% of those users

        There is a demand, I hope the statistics of the following commands in Exchange that user's mailbox capacity of more than 80%, please refer to any other special requirements, can be modified according to the script again

$all=Get-Mailbox -ResultSize Unlimited |Get-MailboxStatistics |sort TotalItemSize -Descending |Select-Object DisplayName,
@{Name="TotalItemSize";Expression={[Double]((($_.TotalItemSize.Value.Tostring()).split(" "))[2]).Trimstart("(") / 1GB}},
@{Name="DatabaseProhibitSendQuota";Expression={[Double]((($_.DatabaseProhibitSendQuota.Value.Tostring()).split(" "))[2]).Trimstart("(") / 1GB}}

foreach($a in $all){
    if ($ a.DatabaseProhibitSendQuota -ne "Unlimited") {# If the quota is not unlimited
       $ TotalSize = ($ a.TotalItemSize / $ a.DatabaseProhibitSendQuota) * 100 # mailbox capacity after conversion / 100 mailbox quota *, draw ratio of capacity occupied by a single mailbox
       if ( "{0: f}" -f $ TotalSize -gt 80.00) {# "{0: f}" -f $ TotalSize is formatted output
                $a.DisplayName
       }
    }
}


Guess you like

Origin blog.51cto.com/11258494/2482794