# Filtering out hidden/system folders in EXO

**URL:** <https://forums.powershell.org/t/filtering-out-hidden-system-folders-in-exo/17978>\
**Category:** PowerShell Help\
**Created:** [November 17, 2021, 8:26pm UTC](https://forums.powershell.org/t/filtering-out-hidden-system-folders-in-exo/17978 "2021-11-17T20:26:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![BrownCoats4Ever](https://avatars.discourse-cdn.com/v4/letter/b/a6a055/32.png) [@BrownCoats4Ever](https://forums.powershell.org/u/BrownCoats4Ever)\
**Post date:** [November 17, 2021, 8:26pm UTC](https://forums.powershell.org/t/filtering-out-hidden-system-folders-in-exo/17978/1 "2021-11-17T20:26:29Z")

</div>

I am trying to write a script to move messages from a shared mailbox to a shared drive, and I’m filtering it for items that are more than 90 days old. The issue is that when I use Get-MailboxFolderStatistics to get the FolderPath, I don’t want to include the hidden/system folders, like Yammer Root, Recoverable Items, etc. I think I have a list of the hidden/system folders that I might be able to use in a ‘-contains’ command, but I was wondering if there was an easier way to do it.

Brian

---

<div class="post-metadata">

**Author:** ![matt-bloomfield](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@matt-bloomfield](https://forums.powershell.org/u/matt-bloomfield)\
**Post date:** [November 17, 2021, 9:36pm UTC](https://forums.powershell.org/t/filtering-out-hidden-system-folders-in-exo/17978/2 "2021-11-17T21:36:03Z")

</div>

I can’t test but looking at the help file, there is `-FolderScope` parameter. Does that help at all?

> **[Get-MailboxFolderStatistics (ExchangePowerShell)](https://docs.microsoft.com/en-us/powershell/module/exchange/get-mailboxfolderstatistics?view=exchange-ps)**
>
> You need to be assigned permissions before you can run this cmdlet. Although this topic lists all parameters for the cmdlet, you may not have access to some parameters if they're not included in the permissions assigned to you. To find the...

---

<div class="post-metadata">

**Author:** ![BrownCoats4Ever](https://avatars.discourse-cdn.com/v4/letter/b/a6a055/32.png) [@BrownCoats4Ever](https://forums.powershell.org/u/BrownCoats4Ever)\
**Post date:** [November 17, 2021, 10:23pm UTC](https://forums.powershell.org/t/filtering-out-hidden-system-folders-in-exo/17978/3 "2021-11-17T22:23:29Z")

</div>

Not really. It’s just another way to filter. I wish I could use Filter, but even if I could, I would have a lot of statements to use to filter out those hidden/system folders. Our Exchange team doesn’t seem to know how to either.

---

<div class="post-metadata">

**Author:** ![krzydoug](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/krzydoug/32/1008_2.png) [@krzydoug](https://forums.powershell.org/u/krzydoug)\
**Post date:** [November 17, 2021, 10:46pm UTC](https://forums.powershell.org/t/filtering-out-hidden-system-folders-in-exo/17978/4 "2021-11-17T22:46:55Z")

</div>

Why don’t you tell us which categories out of that list you _do_ want?

---

<div class="post-metadata">

**Author:** ![BrownCoats4Ever](https://avatars.discourse-cdn.com/v4/letter/b/a6a055/32.png) [@BrownCoats4Ever](https://forums.powershell.org/u/BrownCoats4Ever)\
**Post date:** [November 17, 2021, 11:13pm UTC](https://forums.powershell.org/t/filtering-out-hidden-system-folders-in-exo/17978/5 "2021-11-17T23:13:55Z")

</div>

What I want are the “mail-related” folders that a normal user would see, except for RSS Feeds, Sync Errors, etc. The users of these shared mailboxes all have Full Access, so they would still see those folders in the Folder View, even if they don’t know what they are for. I don’t need those folders, and while I tried putting all the folders that I thought were system/hidden folders and tried doing a simple “if -notcontains” clause, that didn’t seem to work. Not sure why it didn’t, as I’ve used it before with an SCCM script that does a similar comparison. Any ideas/suggestions would be greatly appreciated.

Brian Embree

---

<div class="post-metadata">

**Author:** ![krzydoug](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/krzydoug/32/1008_2.png) [@krzydoug](https://forums.powershell.org/u/krzydoug)\
**Post date:** [November 17, 2021, 11:40pm UTC](https://forums.powershell.org/t/filtering-out-hidden-system-folders-in-exo/17978/6 "2021-11-17T23:40:39Z")

</div>

It’s the etc that gets me, not clear on exactly what you do or don’t want.

With that aside, why not show the code you tried with the simple “if -notcontains” clause? Perhaps just a small change can get you what you want? Please be sure to format any code/errors as code with the preformatted text option (\</\> icon or ctrl + e)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [February 10, 2024, 5:34pm UTC](https://forums.powershell.org/t/filtering-out-hidden-system-folders-in-exo/17978/7 "2024-02-10T17:34:08Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
