locked
Get-MailboxStatistics RRS feed

  • Question

  • Hi all,

    We have Exchange 2007 SP3, and I need a CSV report on all our mailboxes, showing:

    • Username
    • How big the mailbox is
    • What the size of their quota is
    • How much of the quota they have used

    Can anyone assist with an Exchange Powershell script?

    Thanks in advance


    • Edited by RhodanZ Tuesday, October 18, 2011 11:52 PM
    Tuesday, October 18, 2011 11:51 PM

Answers

  • get-mailbox -server "servername" -results Unlimited | get-mailboxstatistics | select-object displayname, StorageLimitStatus, totalitemsize, databasename, @{label="TotalItemSize(MB)";expression={$_.TotalItemSize.Value.ToMB()}}, @{Name="All Quota";expression={(Get-Mailbox $_.Identity | ft *Quota)}} | export-csv c:\report.csv
    


    Jasjit Singh Dhindsa | ITIL v3 | IASA Foundation Certified | MCITP:Exchange 2010 | Exchange 2007 | MCTS:OCS 2007 | Exchange 2010 | Exchange 2007 | MCSA:Messaging | Security | MCSE:Messaging | Security
    • Marked as answer by RhodanZ Monday, October 24, 2011 10:33 PM
    Wednesday, October 19, 2011 4:04 AM

All replies

  • I've basically have these two commands, that I want to combine into one command, to accomplish what I mentioned in my original post:

    get-mailbox -server "servername" -results Unlimited | get-mailboxstatistics | select-object displayname, StorageLimitStatus, totalitemsize, databasename, @{label="TotalItemSize(MB)";expression={$_.TotalItemSize.Value.ToMB()}} | export-csv c:\report.csv

    get-mailbox -server "servername" -results Unlimited | select-object displayname , *Quota | export-csv C:\report.csv

    Any idea how to accomplish this?

    Wednesday, October 19, 2011 3:30 AM
  • get-mailbox -server "servername" -results Unlimited | get-mailboxstatistics | select-object displayname, StorageLimitStatus, totalitemsize, databasename, @{label="TotalItemSize(MB)";expression={$_.TotalItemSize.Value.ToMB()}}, @{Name="All Quota";expression={(Get-Mailbox $_.Identity | ft *Quota)}} | export-csv c:\report.csv
    


    Jasjit Singh Dhindsa | ITIL v3 | IASA Foundation Certified | MCITP:Exchange 2010 | Exchange 2007 | MCTS:OCS 2007 | Exchange 2010 | Exchange 2007 | MCSA:Messaging | Security | MCSE:Messaging | Security
    • Marked as answer by RhodanZ Monday, October 24, 2011 10:33 PM
    Wednesday, October 19, 2011 4:04 AM
  • Hi,

    >@{Name="All Quota";expression={(Get-Mailbox $_.Identity | ft *Quota)}}

    This part you need to write Quota seperately. Such as

    @{Name="ProhibitSendQuota";expression={(Get-Mailbox $_.Identity | select ProhibitSendQuota)}}

    @{Name="ProhibitSendReceiveQuota";expression={(Get-Mailbox $_.Identity | select ProhibitSendReceiveQuota)}}


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Thursday, October 20, 2011 6:51 AM
  • Thanks for all your replies.

    So the final command should look like this?

    get-mailbox -server "servername" -results Unlimited | get-mailboxstatistics | select-object displayname, StorageLimitStatus, totalitemsize, databasename, @{label="TotalItemSize(MB)";expression={$_.TotalItemSize.Value.ToMB()}}, @{Name="ProhibitSendQuota";expression={(Get-Mailbox $_.Identity | select ProhibitSendQuota)}}, @{Name="ProhibitSendReceiveQuota";expression={(Get-Mailbox $_.Identity | select ProhibitSendReceiveQuota)}} | export-csv c:\report.csv
    


    Monday, October 24, 2011 2:38 AM
  • Yes this should be the final command


    Jasjit Singh Dhindsa | ITIL v3 | IASA Foundation Certified | MCITP:Exchange 2010 | Exchange 2007 | MCTS:OCS 2007 | Exchange 2010 | Exchange 2007 | MCSA:Messaging | Security | MCSE:Messaging | Security
    Monday, October 24, 2011 3:51 AM
  • You can give a try on the proposed answer at thread http://social.technet.microsoft.com/Forums/en-US/exchangesvradmin/thread/f4ca382c-ede9-4c3a-896a-bde7f61c4bce/#a13200e8-4a47-427b-bd96-2531d75731c2 by saving script to .ps1

     

     

    You can give a try on the following where a conditional operation has been added to check if a mailbox is using database-level size quota or mailbox-level size quota
    Get-User -ResultSize Unlimited | Where {$_.RecipientType -eq "UserMailbox"} | Select DisplayName, Company, City | foreach {
    $MailboxInfo = Get-Mailbox $_.DisplayName
    $MailboxStat = Get-MailboxStatistics $MailboxInfo
    if($MailboxInfo.UseDatabaseQuotaDefaults) {
    $MailboxDatabaseInfo = get-mailboxdatabase $MailboxInfo.database
    Add-Member -InputObject $_ noteProperty WarningQuota $MailboxDatabaseInfo.IssueWarningQuota
    Add-Member -InputObject $_ noteProperty SendQuota $MailboxDatabaseInfo.ProhibitSendQuota
    Add-Member -InputObject $_ noteProperty SendRecieveQutoa $MailboxDatabaseInfo.ProhibitSendReceiveQuota
    }else{
    Add-Member -InputObject $_ noteProperty WarningQuota $MailboxInfo.IssueWarningQuota
    Add-Member -InputObject $_ noteProperty SendQuota $MailboxInfo.ProhibitSendQuota
    Add-Member -InputObject $_ noteProperty SendRecieveQutoa $MailboxInfo.ProhibitSendReceiveQuota
    }
    Add-Member -InputObject $_ noteProperty QuotaStatus $MailboxStat.StorageLimitStatus 
    Add-Member -InputObject $_ noteProperty TotalItems $MailboxStat.ItemCount
    Add-Member -InputObject $_ noteProperty TotalSizeMB $MailboxStat.TotalItemSize.Value.ToMB()
    Add-Member -InputObject $_ noteProperty DeleteItems $MailboxStat.DeletedItemCount
    Add-Member -InputObject $_ noteProperty DeletedSizeMB $MailboxStat.TotalDeletedItemSize.Value.ToMB() -PassThru
     
    } | Export-Csv -NoTypeInformation -Path C:\MailboxSize.csv

     


    • Edited by shuen100 Monday, October 24, 2011 6:47 AM
    Monday, October 24, 2011 6:45 AM