locked
How to create complete mailbox details with Organisational Unit RRS feed

  • Question

  • Hi,

    Anyone knows how to create a complete mailbox statistics detail including name, alias, mailbox size, database name, OU?

    Thanks

    Sundar

    Wednesday, May 9, 2012 4:30 AM

Answers

  • Hi Sundar,

    You can follow the below blog to Combining two commands get-mailbox and get-mailboxstatistics

    http://get-exchange.blogspot.com/2009/03/did-you-ever-needed-to-supply-list-of.html


    Frank Wang

    TechNet Community Support

    • Proposed as answer by Mike Crowley Tuesday, May 15, 2012 3:33 AM
    • Marked as answer by emma.yoyo Thursday, May 17, 2012 2:21 AM
    Thursday, May 10, 2012 8:42 AM
  • Try something like this (add more values as needed): 

    #this could be made more efficient by only getting mailboxstatistics once and storing it in a variable...
    
    cls
    
    $UserList = Get-mailbox -Resultsize unlimited
    
    $MasterList = @()
    
    foreach ($User in $UserList) {
    
    $MyObject = New-Object PSObject -Property @{
    DisplayName = ($User).DisplayName
    Database = ($User).Database
    ServerName = ($User).servername
    ItemCount = (Get-MailboxStatistics $User).ItemCount
    Lastllogontime =(Get-MailboxStatistics $User).Lastlogontime
    EmailAddress = ($User).PrimarySmtpAddress
    TotalItemSizeInMB = (Get-MailboxStatistics $User).Totalitemsize.value.toMB()
    }
    $MasterList += $MyObject
    }
    
    $MasterList | ft -AutoSize
    read more on this approach: http://wp.me/pAAoj-fD  



    Mike Crowley | MVP
    My Blog -- Planet Technologies


    • Edited by Mike Crowley Monday, May 14, 2012 10:13 PM
    • Marked as answer by emma.yoyo Thursday, May 17, 2012 2:21 AM
    Monday, May 14, 2012 10:11 PM

All replies

  • Hi

    only powershell script

    what you want to find ? 

    get-mailbox somemailbox@domain.com | select name, samaccountname, alias, organizationalunit, displayname, primarysmtpaddress, database

    Remigiusz

    Wednesday, May 9, 2012 6:52 AM
  • Hi Sundar,

    You can follow the below blog to Combining two commands get-mailbox and get-mailboxstatistics

    http://get-exchange.blogspot.com/2009/03/did-you-ever-needed-to-supply-list-of.html


    Frank Wang

    TechNet Community Support

    • Proposed as answer by Mike Crowley Tuesday, May 15, 2012 3:33 AM
    • Marked as answer by emma.yoyo Thursday, May 17, 2012 2:21 AM
    Thursday, May 10, 2012 8:42 AM
  • Hi Sundar,

    Any updates?


    Frank Wang

    TechNet Community Support

    Monday, May 14, 2012 2:39 AM
  • Hi Frank,

    Thanks for your reply.

    I need the mailbox statistics for the whole organizational level or server level. I am running the command like below.

    Get-MailboxStatistics -server 'exchmb1' | where {$_.ObjectClass –eq “Mailbox”} | Sort-Object TotalItemSize –Descending | ft DisplayName, TotalItemSize  | out-file -filepath c:\windows\script\allmailbox.txt
    
    

    But I need the output with Display Name, Total item size, database name, Organization Unit etc. 

    I am getting this output by exporting all users list from EMC and I am merging the above script output in excel sheet. Then comparing both the output by display name then eliminating the unwanted details.  It takes lot of time for formating in excel sheet. I need to get all this by running a single powershell command or script.

    Thanks

    Sundar

    
    
    
    
    
    Monday, May 14, 2012 5:57 AM
  • Hi

    I need the mailbox statistics for the whole server level.

    Sundar

    Monday, May 14, 2012 7:18 PM
  • Try something like this (add more values as needed): 

    #this could be made more efficient by only getting mailboxstatistics once and storing it in a variable...
    
    cls
    
    $UserList = Get-mailbox -Resultsize unlimited
    
    $MasterList = @()
    
    foreach ($User in $UserList) {
    
    $MyObject = New-Object PSObject -Property @{
    DisplayName = ($User).DisplayName
    Database = ($User).Database
    ServerName = ($User).servername
    ItemCount = (Get-MailboxStatistics $User).ItemCount
    Lastllogontime =(Get-MailboxStatistics $User).Lastlogontime
    EmailAddress = ($User).PrimarySmtpAddress
    TotalItemSizeInMB = (Get-MailboxStatistics $User).Totalitemsize.value.toMB()
    }
    $MasterList += $MyObject
    }
    
    $MasterList | ft -AutoSize
    read more on this approach: http://wp.me/pAAoj-fD  



    Mike Crowley | MVP
    My Blog -- Planet Technologies


    • Edited by Mike Crowley Monday, May 14, 2012 10:13 PM
    • Marked as answer by emma.yoyo Thursday, May 17, 2012 2:21 AM
    Monday, May 14, 2012 10:11 PM
  • Hi Frank,

    I need the mailbox statistics for the whole organizational level or server level. I am running the command like below.

    Get-MailboxStatistics -server 'exchmb1' | where {$_.ObjectClass –eq “Mailbox”} | Sort-Object TotalItemSize –Descending | ft DisplayName, TotalItemSize  | out-file -filepath c:\windows\script\allmailbox.txt
    

    But I need the output with Display Name, Total item size, database name, Organization Unit etc. 

    Hi Sundar,

    The cmdlet is included in the link in my last reply. Now I post it here:

    Get-Mailbox -Server servername | where {$_.RecipientTypeDetails -eq "UserMailbox"} | select name,alias,@{n="size";e = {$Mbxstat = Get-MailboxStatistics $_.name;$Mbxstat.totalitemsize}},database,organizationalunit


    Frank Wang

    TechNet Community Support

    Tuesday, May 15, 2012 3:16 AM