header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
Mailbox size and Quotas
Last Post 21 Jul 2010 05:48 AM by rogerm. 4 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Not Resolved
rogermUser is Offline
New Member
New Member
Posts:3
Avatar

--
08 Jul 2010 02:44 PM

    I found and adjusted the script below and it the output is good. However I would like some help to change it so that the output includes labels and spacing.
    from this:

    mike 1723 2048 84.1 %
    pete 1043 2048 50.9 %
    mary 1154 2048 56.3 %
    paul 1047 2048 51.1 %
    john 1449 2048 70.8 %
    peter 1051 2048 51.3 %
    susan 1043 2048 50.9 %


    to something like this:
    NAME Size Quota Percent
    ----- ----- ----- -----
    mike    1723  2048  84.1 %
    pete     1043  2048  50.9 %
    mary    1154  2048  56.3 %
    paul     1047  2048  51.1 %
    john     1449  2048  70.8 %
    peter    1051  2048  51.3 %
    susan    1043  2048  50.9 %

    thanks

     Get-Mailbox -resultsize Unlimited | foreach-object{
        $mbSizeDetails = get-mailboxstatistics $_.identity
        if ($_.UseDatabaseQuotaDefaults -eq $true){
            $dbsetting = get-Mailboxdatabase $_.database
            if ($dbsetting.ProhibitSendReceiveQuota -ne "unlimited"){
                $_.DisplayName + " " + $mbSizeDetails.TotalItemSize.Value.ToMB() + " " + $dbsetting.ProhibitSendReceiveQuota.Value.ToMB() + " " + "{0:P1}" -f ($mbSizeDetails.TotalItemSize.Value.ToMB()/$dbsetting.ProhibitSendReceiveQuota.Value.ToMB())
            }
            else{
                $_.DisplayName + " " + $mbSizeDetails.TotalItemSize.Value.ToMB() + " unlimited"
            }

        }
        else {   
            if ($_.ProhibitSendReceiveQuota -ne "unlimited"){
                $_.DisplayName + " " + $mbSizeDetails.TotalItemSize.Value.ToMB()  + " " + $_.ProhibitSendReceiveQuota.Value.ToMB() + " " + "{0:P1}" -f ($mbSizeDetails.TotalItemSize.Value.ToMB()/$_.ProhibitSendReceiveQuota.Value.ToMB())
            }
            else {
                $_.DisplayName + " " + $mbSizeDetails.TotalItemSize.Value.ToMB()  + " unlimited"
            }
        }
    } | where {$mbSizeDetails.TotalItemSize -gt 850MB} | Sort-Object $mbSizeDetails

    StevenUser is Offline
    New Member
    New Member
    Posts:5
    Avatar

    --
    19 Jul 2010 01:54 PM
    Here's how I'd do it: $users = Get-Mailbox -ResultSize unlimited $report = @() foreach ($mbx in $users) { $mbxReport = "" | select Name,Size,Quota,Percent $mbxReport.Name = $mbx.name $mbxReport.size = $($mbx | Get-MailboxStatistics).totalItemSize.value.toMB() if($mbxReport.size -lt 600){continue} if ($mbx.UseDatabaseQuotaDefaults -eq $true) { $mbxReport.Quota = ($(get-mailboxDatabase -identity $mbx.database).ProhibitSendReceiveQuota).value.toMB() } else { $mbxReport.Quota = $($mbx.ProhibitSendReceiveQuota).value.toMB() } $mbxReport.Percent = "{0:P1}" -f ($mbxReport.size / $mbxReport.quota) $report += $mbxReport } $report | Format-Table -AutoSize
    rogermUser is Offline
    New Member
    New Member
    Posts:3
    Avatar

    --
    21 Jul 2010 04:51 AM
    Thanks very much this looks great.
    There is one error though when there are no send/receive limits

    [PS] C:\Scripts>.\testmb.ps1
    You cannot call a method on a null-valued expression.
    At C:\Scripts\testmb.ps1:16 char:104
    + $mbxReport.Quota = ($(get-mailboxDatabase -identity $mbx.database).ProhibitSe
    ndReceiveQuota).value.toMB( <<<< )

    Name Size Quota Percent
    ---- ---- ----- -------
    John, Smith 2563 Infinity

    I ran it on another exchange server that had proper limits and the output was great.
    StevenUser is Offline
    New Member
    New Member
    Posts:5
    Avatar

    --
    21 Jul 2010 05:40 AM
    There is one error though when there are no send/receive limits.
    yikes, not having a send/receive limit can be dangerous. I generally always have some kind of hard cap on a database\mailboxes quota so that a mailbox can't get overrun with mail and fill up the disk. That aside glad it worked for you. I'm sure there are 1,000 ways to skin this cat, but that's just how I'd do it.
    rogermUser is Offline
    New Member
    New Member
    Posts:3
    Avatar

    --
    21 Jul 2010 05:48 AM
    Thanks. You are absolutley right. This is a client who is a pain in the ...... but we are gonna set him straight with limits.
    The good thing is it just spits out the info (minus the error) to my text file so it is nice and clean and it catches a percentage of "Infinity" so I know if I see infinities I have a problem. I added a line to just output anything over 80%.

    thanks again.
    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer