While working with Exchange public folders, I was required to find public folder paths. Most Exchange PowerShell cmdlets require the complete folder path in the -Identity parameter.
In this tutorial, I will show several efficient ways to find public folder paths quickly using PowerShell. I will also explain how to search for folders by name when you don’t know the exact path.
Method 1: Get All Public Folders and Their Paths (The Foundation)
The most fundamental command for working with public folder paths is Get-PublicFolder with the -Recurse parameter in PowerShell.
Basic command:
Get-PublicFolder -Recurse -ResultSize Unlimited | Select-Object IdentityWhat this does:
Get-PublicFolder: Retrieves public folder attributes.-Recurse: Goes through all subfolders, not just top-level folders-ResultSize Unlimited: Ensures you get ALL folders (by default, Exchange limits results)Select-Object Identity: Shows you just the path, not all the other properties
Pro tip: The Identity property shows the full hierarchical path, which is exactly what you need for other PowerShell commands. For example, you might see something like \Sales\Reports\Q4-2025.
Check out How to Find a Folder by Name in PowerShell?
Method 2: Search for a Specific Folder by Name
In large organizations with hundreds or thousands of public folders, you don’t want to scroll through everything. Here’s how to find a specific folder when you only know its name by using PowerShell cmdlets:
Get-PublicFolder -Recurse -ResultSize Unlimited | Where-Object {$_.Name -like "*FolderName*"}Example: Let’s say you’re looking for a folder with “Sales” in the name:
Get-PublicFolder -Recurse -ResultSize Unlimited | Where-Object {$_.Name -like "*Sales*"} | Select-Object Identity, NameThis will return all folders containing “Sales” along with their full paths.
Common pitfall: The -like operator is case-insensitive and uses wildcards (*). If you want an exact match, use -eq instead:
Where-Object {$_.Name -eq "Sales"}Check out Create a Folder with Today’s Date and Copy Files to it using PowerShell
Method 3: Export the Complete List to CSV (For Documentation)
When you need to document your public folder structure or share it with your team, exporting to CSV is incredibly useful:
Get-PublicFolder -Recurse -ResultSize Unlimited | Select-Object Identity, Name | Export-Csv -Path "C:\PublicFolders.csv" -NoTypeInformation -Encoding UTF8Why I like this approach:
- You can open the CSV in Excel and use filtering/sorting to find what you need
- It serves as a snapshot of your folder structure at a point in time
- You can share it with colleagues who don’t have PowerShell access
Pro tip: Add more properties to your export for a more complete report:
Get-PublicFolder -Recurse -ResultSize Unlimited | Select-Object Identity, Name, FolderClass, ItemCount | Export-Csv -Path "C:\PublicFolders.csv" -NoTypeInformationRead How to Set Folder Permissions Using PowerShell
Method 4: Get Detailed Information Including Permissions
If you need to see not just paths but also who has access to folders, combine Get-PublicFolder with Get-PublicFolderClientPermission:
$folders = Get-PublicFolder -Recurse -ResultSize Unlimited
foreach ($folder in $folders) {
Get-PublicFolderClientPermission -Identity $folder.Identity | Select-Object Identity, User, AccessRights
}This loops through each folder and shows who has permissions and what level of access they have.
Best practice: For large environments, this can take a while. Consider filtering to specific folders first or running it during off-peak hours.
Check out Create Folder Structure from CSV using PowerShell
Important Points:
Here are some important points that you should remember.
- Forgetting
-ResultSize Unlimited: By default, Exchange only returns the first 1,000 results. In large environments, you’ll miss folders. - Not using the full path in subsequent commands: If you find a folder named “Reports”, you can’t just use
-Identity "Reports"in other commands. You need the full path like-Identity "\Sales\Reports". - Running these commands without appropriate permissions: You need at least read access to all public folders you’re querying. In on-premises Exchange, run PowerShell as an administrator with Exchange Organization Management rights.
- Mixing up Name vs. Identity:
Nameis just the folder name (e.g., “Reports”).Identityis the full path (e.g., “\Sales\Reports”). Most cmdlets require Identity.
Conclusion
In this tutorial, I explained how to find public folder paths in PowerShell using various methods.
- Always use
-Recurseand-ResultSize Unlimitedto see everything - The
Identityproperty gives you the full path you need for other commands
Now it’s your turn! Open up your Exchange Management Shell or connect to Exchange Online via PowerShell and try these commands. Start simple with Get-PublicFolder -Recurse and build from there.
Have questions or run into issues? Drop a comment below — I’m happy to help troubleshoot!
You may also like:
Bijay Kumar is an esteemed author and the mind behind PowerShellFAQs.com, where he shares his extensive knowledge and expertise in PowerShell, with a particular focus on SharePoint projects. Recognized for his contributions to the tech community, Bijay has been honored with the prestigious Microsoft MVP award. With over 15 years of experience in the software industry, he has a rich professional background, having worked with industry giants such as HP and TCS. His insights and guidance have made him a respected figure in the world of software development and administration. Read more.