Exchange Inbox Report

Welcome Forums General PowerShell Q&A Exchange Inbox Report

This topic contains 6 replies, has 3 voices, and was last updated by

 
Participant
4 months, 1 week ago.

  • Author
    Posts
  • #129288

    Participant
    Topics: 1
    Replies: 2
    Points: 18
    Rank: Member

    I am wanting to send a daily report to our managers that will let them know how many emails are in someones inbox. The script I have so far is below. The problem is Get-MailboxFolderStatistics also reports hidden items in that folder. So it is not a realistic number of emails in their inbox. Does anyone have an idea on how to list only the emails and not the hidden content?

    Get-DistributionGroupMember -Identity "CS" | Get-Mailbox | Get-MailboxFolderStatistics -IncludeOldestAndNewestItems | Where {$_.Name -match “Inbox”} | Select Identity, Name, ItemsInFolder, OldestItemReceivedDate, NewestItemReceivedDate | Sort-Object ItemsInFolder -descending | Export-csv c:\MailboxItemCountInbox.csv
  • #129404

    Participant
    Topics: 47
    Replies: 156
    Points: 42
    Rank: Member

    edit: completely missread the post thought you wanted just the mailer

     

    This should do the trick

     

    
    Get-DistributionGroupMember -Identity "CS" | Get-Mailbox | Get-MailboxFolderStatistics -IncludeOldestAndNewestItems | Where {$_.Name -match “Inbox”} | Select Identity, Name, ItemsInFolder, OldestItemReceivedDate, NewestItemReceivedDate | Sort-Object ItemsInFolder -descending | Export-csv c:\MailboxItemCountInbox.csv
    
    $smtpServer = "smtp.domain.com"
    $From = "NoReply@domain.com"
    $Subject = "Mailbox Results"
    $Body = "Attached are the results of mailbox query ran on the mailbox CS"
    $attachment = "c:\MailboxItemCountInbox.csv"
    $to = "someone@domain.com"
    $bcc = "Yourself@domain.com"
    
    #Mail
    Send-Mailmessage -smtpServer $smtpServer -from $from -to $to -Bcc $bcc -subject $subject -priority High -Body $Body -attachment $attachment
    
    
  • #129354

    Participant
    Topics: 2
    Replies: 7
    Points: 71
    Rank: Member

    Depending on how many mailboxes you are looking at, if not to many, you could do new-mailboxsearch

  • #129482

    Participant
    Topics: 1
    Replies: 2
    Points: 18
    Rank: Member

    My thought was have it list only the email between the OldestItemReceivedDate and NewestItemReceivedDate but I haven't figured out how to make that work yet. I also looked into using the Mailboxsearch but couldn't figure out how to make it search only the users' inboxes and provide a count only.

  • #129650

    Participant
    Topics: 2
    Replies: 7
    Points: 71
    Rank: Member

    This should do it for you.

    Get-DistributionGroupMember -Identity "CS" | foreach { Get-MailboxFolderStatistics $_.alias | where { $_.name -eq "inbox" } | select Identity, ItemsInFolder, ItemsInFolderAndSubfolders}

     

    • #129711

      Participant
      Topics: 1
      Replies: 2
      Points: 18
      Rank: Member

      This still lists hidden data in the inbox because you are using the Get-MailboxFolderStatistics without anyway of filtering the results.

  • #129719

    Participant
    Topics: 2
    Replies: 7
    Points: 71
    Rank: Member

    I don't understand what is hidden in the inbox or inbox and subfolders?
    when you return results for just those foldernames it should be showing the correct count
    Outlook on the other hand may be doing some kind of filtering not showing the messages. But that would be totally client side.

     

The topic ‘Exchange Inbox Report’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort