Windows Vista Forums

Exporting Mailbox Statistics - DN or CN

  1. #1


    Jon LaBarge Guest

    Exporting Mailbox Statistics - DN or CN

    I am having trouble finding a good way to export Exchange 2007 mailbox
    statistics. Here's what I need to do:

    Export a CSV that includes:
    1.) User name (which is no problem)
    2.) Mailbox Size in MB (which is also no problem)
    3.) The Distinguished Name or Container Name of the user (HUGE problem)

    I need this to be done for only one server and the get-mailbox |
    get-mailboxstatistics -server <servername> cmdlet allows this, but I cannot
    for the life of me figure out how to add the DN or CN to the query.

    Anyone know a way to do this?

    TIA!



    Jon



      My System SpecsSystem Spec

  2. #2


    Rob Campbell Guest

    RE: Exporting Mailbox Statistics - DN or CN

    This seems to work.


    $mbx_stats = @()
    Get-MailboxStatistics -Server <servername> |% {
    $mbx = "" | select name,size,dn,cn
    $mbx.name = $_.displayname
    $mbx.size = $_.totalitemsize
    if (get-mailbox $_.legacydn){
    $mbx.dn = (Get-Mailbox $_.legacydn).distinguishedname
    $mbx.cn = (Get-Mailbox $_.legacydn).organizationalunit
    $mbx_stats += $mbx
    }
    }
    $mbx_stats | Export-Csv stats.csv -notype


    "Jon LaBarge" wrote:

    > I am having trouble finding a good way to export Exchange 2007 mailbox
    > statistics. Here's what I need to do:
    >
    > Export a CSV that includes:
    > 1.) User name (which is no problem)
    > 2.) Mailbox Size in MB (which is also no problem)
    > 3.) The Distinguished Name or Container Name of the user (HUGE problem)
    >
    > I need this to be done for only one server and the get-mailbox |
    > get-mailboxstatistics -server <servername> cmdlet allows this, but I cannot
    > for the life of me figure out how to add the DN or CN to the query.
    >
    > Anyone know a way to do this?
    >
    > TIA!
    >
    > Jon
    >
    >
    >

      My System SpecsSystem Spec

  3. #3


    Jon LaBarge Guest

    Re: Exporting Mailbox Statistics - DN or CN

    Rob,

    This was PERFECT! Thanks for the help! One quick question....If I were to
    change the value $mbx.size = $_.totalitemsize to $mbx.size =
    $_.totalitemsizeToMb, would that make the size in MBs?



    Jon

    "Rob Campbell" <RobCampbell@xxxxxx> wrote in message
    news:F6DE6F45-E3A8-45BB-B13F-E23954BD83F8@xxxxxx

    > This seems to work.
    >
    >
    > $mbx_stats = @()
    > Get-MailboxStatistics -Server <servername> |% {
    > $mbx = "" | select name,size,dn,cn
    > $mbx.name = $_.displayname
    > $mbx.size = $_.totalitemsize
    > if (get-mailbox $_.legacydn){
    > $mbx.dn = (Get-Mailbox $_.legacydn).distinguishedname
    > $mbx.cn = (Get-Mailbox $_.legacydn).organizationalunit
    > $mbx_stats += $mbx
    > }
    > }
    > $mbx_stats | Export-Csv stats.csv -notype
    >
    >
    > "Jon LaBarge" wrote:
    >

    >> I am having trouble finding a good way to export Exchange 2007 mailbox
    >> statistics. Here's what I need to do:
    >>
    >> Export a CSV that includes:
    >> 1.) User name (which is no problem)
    >> 2.) Mailbox Size in MB (which is also no problem)
    >> 3.) The Distinguished Name or Container Name of the user (HUGE problem)
    >>
    >> I need this to be done for only one server and the get-mailbox |
    >> get-mailboxstatistics -server <servername> cmdlet allows this, but I
    >> cannot
    >> for the life of me figure out how to add the DN or CN to the query.
    >>
    >> Anyone know a way to do this?
    >>
    >> TIA!
    >>
    >> Jon
    >>
    >>
    >>


      My System SpecsSystem Spec

  4. #4


    Rob Campbell Guest

    Re: Exporting Mailbox Statistics - DN or CN

    $_.totalitemsizeToMb doesn't seem to work.

    Try: $_.totalitemsize.value.tomb()

    "Jon LaBarge" wrote:

    > Rob,
    >
    > This was PERFECT! Thanks for the help! One quick question....If I were to
    > change the value $mbx.size = $_.totalitemsize to $mbx.size =
    > $_.totalitemsizeToMb, would that make the size in MBs?
    >
    >
    >
    > Jon
    >
    > "Rob Campbell" <RobCampbell@xxxxxx> wrote in message
    > news:F6DE6F45-E3A8-45BB-B13F-E23954BD83F8@xxxxxx

    > > This seems to work.
    > >
    > >
    > > $mbx_stats = @()
    > > Get-MailboxStatistics -Server <servername> |% {
    > > $mbx = "" | select name,size,dn,cn
    > > $mbx.name = $_.displayname
    > > $mbx.size = $_.totalitemsize
    > > if (get-mailbox $_.legacydn){
    > > $mbx.dn = (Get-Mailbox $_.legacydn).distinguishedname
    > > $mbx.cn = (Get-Mailbox $_.legacydn).organizationalunit
    > > $mbx_stats += $mbx
    > > }
    > > }
    > > $mbx_stats | Export-Csv stats.csv -notype
    > >
    > >
    > > "Jon LaBarge" wrote:
    > >

    > >> I am having trouble finding a good way to export Exchange 2007 mailbox
    > >> statistics. Here's what I need to do:
    > >>
    > >> Export a CSV that includes:
    > >> 1.) User name (which is no problem)
    > >> 2.) Mailbox Size in MB (which is also no problem)
    > >> 3.) The Distinguished Name or Container Name of the user (HUGE problem)
    > >>
    > >> I need this to be done for only one server and the get-mailbox |
    > >> get-mailboxstatistics -server <servername> cmdlet allows this, but I
    > >> cannot
    > >> for the life of me figure out how to add the DN or CN to the query.
    > >>
    > >> Anyone know a way to do this?
    > >>
    > >> TIA!
    > >>
    > >> Jon
    > >>
    > >>
    > >>
    >
    >
    >

      My System SpecsSystem Spec

Exporting Mailbox Statistics - DN or CN

Similar Threads
Thread Thread Starter Forum Replies Last Post
Clear statistics? Brandon Taylor Vista Games 5 19 May 2010
Mailbox question: Emails show up in the user computer with Cache enabled but disappear from the mailbox in the Server Pedro R. SBS Server 3 05 Nov 2009
Exchange 07 Shell - Export-Mailbox and Disable-Mailbox cmdLETS JSC PowerShell 2 04 Mar 2009
Printer statistics The Key PowerShell 1 12 Aug 2008
Solitaire Statistics is bad jimpuls Vista Games 3 07 Oct 2006