I have a script that generates a report on a set of mailboxes in an OU and how many messages are in the Inbox using the following command:
Get-MailboxFolderStatistics $mailbox -FolderScope Inbox | Where {$_.FolderPath -eq "/Inbox"}
There is a lot more to this script and it outputs a lot of information, but the count of items in the inbox is always wrong. It seems to be counting a lot of hidden items which users cannot see. From my reading in many forums this is a common problem, and so far I have not found a solution.
Is there a way to fun the Get-MailboxFolderStatistics command and folder out hidden objects?