none
Powershell detailed report with get-mailboxstatistics older than 24 months? RRS feed

  • Question

  • I've searched the forums and googled a fair amount this morning and unfortunately I haven't found an example what I'm trying to do.

    I run this script routinely in my environment at the request of management.  Historically management were trying to get information on users that have have mail 24 months old.

    They are now asking for two changes.

    1. Change from ‘newer than 24 months’ to '24 months old and older'
    2. Can the report include what their quota limit is currently set to? And/Or if it's set at all?

    I'm frankly at the limit of my PowerShell abilities what I have is the result of what I was able to plagiarize and cobble together from online sources and the MS Script Center.

    Anyone know what I can do at this point?  

    Thanks for any help.

    $Givens =      @{n="Given Name";e={$user.FirstName}}
    $Lasts =       @{n="Last Name";e={$user.LastName}}
    $Itemsize =    @{n="Size of Items Found";e={([Microsoft.Exchange.Data.ByteQuantifiedSize]$search.ResultItemsSize).ToMb()}}
    $MailboxSize = @{n="Mailbox Size";e={$statistics.totalitemsize.value.toMB()}}
    $mailboxes = Get-mailbox -resultsize unlimited
    $mailboxes | foreach {
    $user = Get-User $_
    $statistics = get-mailboxstatistics $_
    $search = Search-Mailbox –identity $_ -searchquery ‘received:<4/1/2011 OR sent:<4/1/2011’ -estimateresultonly
    $_ | select $Givens, $Lasts, primarySMTPAddress, $ItemSize, $MailboxSize 
    } | Export-CSV -NoTypeInformation "c:\scripts\oldmail\newoldmail24m_4-14-2013.csv"




    Thursday, April 25, 2013 5:20 PM