Get-MailboxStatistics command to run and not count hidden objects

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?

`Thank you for the response, but unfortunately I have been tasked to find a way to get this working. I understand that the Get-MailboxStatistics command is unable to filter out hidden items but I need to find a way to make this report possible. I can understand
the limitations of the command and the technology, but unfortunately the CEO of our company will not accept that as an answer and making this report working is not an option.
To at least allow the report to function for now, I have created a report which manually adjusts for the hidden objects in each box. This does require the manual effort however of adjusting an input file which keeps track of the number of hidden objects
in each box. Here is the code that generates the report:
$mailboxes = @(get-mailbox -OrganizationalUnit "<ORGANIZATION UNIT>")
$report = @()
foreach ($mailbox in $mailboxes)
    $inboxstats = Get-MailboxFolderStatistics $mailbox -FolderScope Inbox | Where {$_.FolderPath -eq "/Inbox"}
    $MailboxInfo = Get-MailboxStatistics $mailbox | Select LastLoggedOnUserAccount,LastLogonTime,LastLogoffTime
    $inboxstatCount = Get-MailboxFolderStatistics $mailbox -FolderScope Inbox | Where {$_.ItemsInFolder -gt 0 -and $_.FolderType -like "Inbox"}
    $RawInboxCount = $inboxstatCount.ItemsInFolder
    if ($mailbox.DisplayName -like "BillingFaxes")
        $CurrentHiddenCount = "$HiddenCountBillingFaxes"
    If ($mailbox.DisplayName -eq "callcenter")
        $CurrentHiddenCount = $HiddenCountcallcenter
    If ($mailbox.DisplayName -eq "lab")
        $CurrentHiddenCount = $HiddenCountcathlab
    If ($mailbox.DisplayName -eq "cviholter")
        $CurrentHiddenCount = $HiddenCountcviholter
    If ($mailbox.DisplayName -eq "medrecs")
        $CurrentHiddenCount = $HiddenCountmedrecs
    If ($mailbox.DisplayName -eq "appointments")
        $CurrentHiddenCount = $HiddenCountNFRappointments
    If ($mailbox.DisplayName -eq "pharmacy")
        $CurrentHiddenCount = $HiddenCountpharmacy
    If ($mailbox.DisplayName -eq "referrals")
        $CurrentHiddenCount = $HiddenCountreferrals
    If ($mailbox.DisplayName -eq "research")
        $CurrentHiddenCount = $HiddenCountresearch
    #else
    #{ $CurrentHiddenCount = "No Value" }
    #DIAGNOSTIC VALUES OUTPUT
    Write-Host "--------------------------------------------------------------"
    Write-Host "Current Mailbox" $mailbox.DisplayName
    Write-Host "Current Inbox Count from the report=" $RawInboxCount
    Write-Host "Current Hidden Count Number" $CurrentHiddenCount
    Write-Host "The Math should equal " ($RawInboxCount - $CurrentHiddenCount)
    $mbObj = New-Object PSObject
    $mbObj | Add-Member -MemberType NoteProperty -Name "Display Name" -Value $mailbox.DisplayName
    $mbObj | Add-Member -MemberType NoteProperty -Name "Inbox Size (Mb)" -Value $inboxstats.FolderSize.ToMB()
    $mbObj | Add-Member -MemberType NoteProperty -Name "Inbox Items" -Value ($RawInboxCount - $CurrentHiddenCount)
    $mbObj | Add-Member -MemberType NoteProperty -Name "Last User to Log On" -Value $MailboxInfo.LastLoggedOnUserAccount
    $mbObj | Add-Member -MemberType NoteProperty -Name "Time User was last logged in" -Value $MailboxInfo.LastLogonTime
    $mbObj | Add-Member -MemberType NoteProperty -Name "Time User last logged off" -Value $MailboxInfo.LastLogoffTime
    $report += $mbObj
All $Hidden----- variables are set to values from an imported file that must be updated regularly. It's messy, but at least it is getting the information we need to those that need it. If anyone can suggest a way to make this work without the constant need
to adjust the numbers for hidden items please let me know.

Similar Messages

  • How do we get the plugin to run and not crash flash and shockwave constantly?

    the shockwave and flash players crash constantly in Facebook apps ... every indication is that the plug in container grinds away with extraneous programming down loaded to it without my knowledge or permission. it also slows the over all performance of all systems or apps that i attempt to run for the same reasons. how do i get rid of those unwanted and unneeded programs and prevent their return ?

    You can change the permissions that are stored in the browser in the "about:permissions" page, however if its the plug in container [http://mzl.la/MLXx5x What is a plug in container? ] you can manage the plug in with these [https://support.mozilla.org/en-US/kb/use-plugins-play-audio-video-games instructions] and if you are running into specific issues you can troubleshoot [https://support.mozilla.org/en-US/kb/troubleshoot-issues-with-plugins-fix-problems the plugins with these]
    If you have any specific questions we are happy to help as well. Making them go away would prevent you from being able to watch/play the flash apps
    This also checks if they are up to date [http://www.mozilla.org/en-US/plugincheck/]
    [[Adobe Flash plugin has crashed - Prevent it from happening again]]

  • So if i get snow leopard, and B4 i began do i have to back-up or jus let it run and not worry about anything?

    So if i get snow leopard, and B4 i began do i have to back-up or jus let it run and not worry about anything?

    Make sure your Mac meets Snow Leopard's minimum requirements.
    Mac computer with an Intel processor
    1GB of memory
    5GB of available disk space
    DVD drive for installation
    Mac OS X v10.5, v10.6: How to back up and restore your files

  • There are times when I try to start firefox 3.6 that it does not come up,but when I click it again, I get fire fox is running but not responing, close fire fox, or shut down computer. There are other times that it starts up normaly wit no probs

    # Question
    there are times when I try to start firefox 3.6 that it does not come up,but when I click it again, I get fire fox is running but not responding, close fire fox, or shut down computer. There are other times that it starts up normally wit no probs
    ..

    Not using any mouse pad, I have a very smooth desktop. But I just tried to use a sheet of A4 printing paper, but no result, the problem persisted.
    Someone on this forum suggested, that USB3 may interfere with the magic mouse.
    I have 2 LaCie HDD's about 70 cm away from the mouse, I use them on Thunderbolt. But in operation or not - the result is the same, the mouse plays up! Just now I was clicking the desktop and the mouse created a new folder!!
    Thanks for the advice, Bee
    Cheers, Gerd

  • I am having trouble with Firefox not closing properly. I close a session and when I try to open firefox again it tells me firefox is already running and not responding.

    When I close Firefox and try to open the browser next time it tells me Firefox is already running and not responding.

    See "Hang at exit":
    *http://kb.mozillazine.org/Firefox_hangs
    See "Firefox hangs when you quit it":
    *https://support.mozilla.com/kb/Firefox+hangs

  • The original u201CBP_CONFIRMu201D is running and not the redefine one.

    Hi,
    In Component CRMCMP_BPIDENT,
    I have enhanced the custom controller CRMCMP_BPIDENT/CuCoBuPa
    and redefined the method u201CBP_CONFIRMu201D with my logic.
    But when I run the IC web client the original u201CBP_CONFIRMu201D is running and not the redefine one.
    Why ?
    Thanks in advance.

    Amit,
    We have not yet transported our Enhancement Set through the landscape, but I suspect you will need to maintain the assignment (BSPWDV_EHSET_ASG) in each system for the reason you give. 
    Your created Enhancement Set (BSPWDV_EHSET_DEF) will still transport through, then you will need to go into table maintenance for BSPWDV_EHSET_ASG once the set has been transported into your QAS system, and then assign it to your QAS clients.
    Many thanks,
    Andrew Griffin.

  • Why is my macbook air getting so hot, fan running, and burning through the battery fast?

    why is my macbook air getting so hot, fan running, and burning through the battery fast?

    I have started to experience my computer getting really hot also. Since one month back in time it has started to get raging hot (up to 99 degrees celsius) just by surfing the internet. Sometimes it stays that hot but most of the time the temperature gets lower after about 15 minutes..
    this has never happend before and i am starting to get worried..
    what is the problem and is there a sollution??

  • Why my macbook air getting so hot, fan running, and burning through the battery fast?

    why my macbook air getting so hot, fan running, and burning through the battery fast?

    are you playing intense games on your Air?
    If so, that would be the reason
    More details necessary for evaluation, please

  • Why are my emails getting caught in my outbox and not sending?

    Why are my emails getting caught in my outbox and not sending?

    This started happening to me immediately after updating to 10.9.3. None of the suggestions that I could find through Google (orotherwise) helped at all. Mail.app simply does not try to empty the outbox. I would call AppleCare, but they'll just tell me that the software is fine and that it's unreasonable for me to expect to be able to send email.
    Apple support is a dim shadow of it's former self, but it correctly reflects teh state of Apple development. I picked a horrible time to switch to Mac.

  • Firefox 29.0.1 on Windows 7 (64-bit): ALWAYS get "Firefox is already running but not responding..." error and need Task Manager to close/restart Firefox.

    I run Firefox 29.0.1 on Windows 7 (64 bit) and I get the "Firefox is already running but not responding. In order to open the program you must close the existing window." error. EVERY TIME I try to start Firefox. The posted solution works to start the program, but it is not a permanent solution. I go through the Task Manager and end the old Firefox process, then I can open a new window. While working, I can open multiple tabs and multiple windows, everything seems to (usually) work the way it should. Then after I completely exit Firefox, in order to open the program again I need to fix the SAME error again. Every time. It doesn't seem to hurt anything really, but it is quite annoying.
    I used to get this same error on some of the older Firefox versions but it was only once in a while. With the new 29.0.1 it is literally EVERY TIME I TRY TO RUN FIREFOX!!!!
    So, down to the big question: is there a permanent fix for this yet? Or will there be one included in the next version update? Or am I going to have to go back to Internet Explorer? I know I am not alone in this experience; i've seen several other users posting similar questions but none of them received satisfactory answers. So what's the story here, team Firefox?

    '''https://support.mozilla.org/questions/997866?esab=a&s=&r=1&as=s'''.<BR>
    This is not a cure but will make it easier if Firefox locks up.

  • Why do I get 'mobile me' in settings and not icloud? when I try to go into it, it says not responding, try later.

    Hi
    Could anyone help me with this please?
    Why do I get 'mobile me' in settings on my imac and not 'icloud'? when I try to go into it, it says not responding, try later.
    Thanks

    Why do I get 'mobile me' in settings on my imac and not 'icloud'?
    Because your operating system is too old. iCloud was introduced in Mac OS X 10.7.4 and later. You can upgrade through the Mac App Store. The latest version is Mac OS X 10.9.3 and is free if your Mac is capable of running it (late 2007 IMac's and newer).
    when I try to go into it, it says not responding, try later.
    MobileMe was shut down forever a few years ago, that's why it doesn't work any more.

  • How to get Current Background Job name and Job Count programmically?

    Hi all,
            I have a requirement wherein I need to get the Current Background Job name and Job Count in the program and store it in a custom table. In other words, whenever I schedule a particular program ( This is a Std program) in background, I need to update this table with the Job Name and Job Count. This will be used by another program later to read the Job Information from table TBTCO. TBTCO has key fields Job Name and Job ID. The sheduled program will be a SAP standard program and I'll be writing the logic to get the info in an Implicit Enhancement Spot.
    Is there anyway I can do this? Any FM to get this information?
    Thanks,
    Mahesh.

    Hey Adrian,
                             Thanks a lot. This is what exactly i was looking for. Appreciate it.
    Mahesh.

  • Command to run and begin playing project?

    For some plugin development tasks, it would be helpful if there were a command to load and begin playing a project at 100% zoom immediately upon AE starting up. I've been able to get AE to load my project by passing it as the first command line argument. Is there a way to then start playing immediately?

    Shachar is right, you'll need to use scripting for that.  Here's what I did from the command line on Windows:
    C:\Program Files\Adobe\Adobe After Effects CS5.5\Support Files>AfterFX -s "var my_file = new File('D:\\Test Files\\Projects\\AEP\\5.5.aep'); app.open(my_file); app.executeCommand(2285); app.exitAfterLaunchAndEval = false;"
    2285 is the command ID for RAM Preview, from the SDK Guide documentation for AEGP_DoCommand().

  • Why does the Firefox Update that I accessed keep running and not complete its task?

    The routine updates that Firefox sends to me have always worked just fine. Now though the latest update I have been trying to access just keeps running and never completes the task. The motion bar that shows the user that the update is running never stops. I have come back minutes later to find the motion bar still running. I have tried to access this particular update several times now and it always does the same thing; just keeps running and never stops.

    see https://support.mozilla.com/en-US/questions/836550

  • Getting Error: The number range is not maintained for Object/Year: J_1ILIC/

    Hi Gurus,
    When I try to capture deemed export license from J1ILIC01 I get this error
    The number range is not maintained for Object/Year: J_1ILIC/
    I tried to maintain number ranges in SNRO & SNUM  there the changes are saved but I am not able to capture the license and receive the same error again. Please help.

    Hi
    Just check if you have maintained number range for the correct year as shown in error.
    Goto SNRO/SNUM enter the object ID and click on number range .Maintain there for that particular year.

Maybe you are looking for

  • Are there any Outlook Email Sync Tools Available f...

    Hi, I've had the n900 for a while now, bit peeved with it, was sold as having proper tbt gps etc, that's another story I guess and one which is well documented elsewhere . Only getting round to setting up my email sync now and guess what, it doesn't

  • Trying to flip display on vga projector connected to iPad2

    Trying to invert display on vga connected projector, but the ipad2 keeps "correcting" it.  Can you lock the display somehow?

  • ITunes library will not load

    I opened my iTunes library and all files are gone. I'm currently storing my files on an external hard drive, which seems to be connected and working fine. All of my files are still on the hard drive and I can reload the library, but wanted to avoid t

  • 7.1 Update & Can't Make Calls

    03/11 Just updated my 5S and can't make any calls out.  I did receive a call but no calls out. I can't even call my wife's 5S which is by my side.  Any thoughts out there?  Thanks for your help. Mike

  • Working with RAW images in Aperture

    I shoot with a Canon DSLR in RAW. I notice that certain adjustments when applied to a RAW file have no effect ie. sharpen, edge sharpen, noise reduction and maybe more. I suspect that these adjustments are applicable to either a TIFF of JPEG file. Co