PowerShell scripts to fetch public folder statistics
IT admins choose to mail-enable or disable public folders in Exchange Online to create an effective email delivery system for specific groups in an organization without actually giving employees control over the mailboxes.
Here are a few PowerShell scripts that help admins access statistics on public folders within their organization.
Fetch root public folder
Get-PublicFolder -ResultSize Unlimited
This PowerShell cmdlet uses the Get-PublicFolder command, without parameters, to return the root public folder object (IPM_SUBTREE).
Return all public folders
Get-PublicFolder -Identity "\Legal\Documents\Pending Litigation" -Recurse -ResultSize Unlimited
This PowerShell cmdlet returns the Pending Litigation public folder and all the public folders under it.
Get public folder statistics
Get-PublicFolderStatistics -Identity "\Marketing\2018\Pamphlets" | Format-List -ResultSize Unlimited
This PowerShell cmdlet returns data about the items within the public folder Pamphlets, with a piped command to format the list.
Export the output in a CSV file
Get-PublicFolderItemStatistics -Identity "\Marketing\Reports" | Select Subject,LastModificationTime,HasAttachments,ItemType,MessageSize | Export-CSV C:\PFItemStats.csv -ResultSize Unlimited
This PowerShell cmdlet exports the following information about every email located in the public folder Reports to the PFItemStats.csv file: subject, last modification time, attachments, type of the item, and message size.
Why M365 Manager Plus is a better choice
With M365 Manager Plus, you can:
- Get a bird's-eye view of public folders, including mail-enabled ones, without having to type line after line of code.
- Easily export all these reports to PDF, HTML, CSV, and XLSX formats, and schedule them to be emailed at designated intervals.
Reports for easy public folder management
Public Folders: See all the public folders available in your Microsoft 365 setup, along with their names and paths.
Mail Enabled Public Folders: View all mail-enabled public folders available in your Microsoft 365 setup, including their display name, email aliases, creation date, and email addresses.
Mail Enabled Public Folder Items: Get an overview of the items present in mail-enabled public folders, with details such as item type, item size, last modification time, creation date, and item subject.
Mail Enabled Public Folder Statistics: Access all the information you could need about mail-enabled public folders, such as their item count, owner count, creation date, deleted item sizes, and last modification time.
Public Folder Activity: Generate an audit trail of user activities in public folders, including details on who created which public folder and when, what operation was performed, and the status of the operation.
Advantages of M365 Manager Plus' reporting capabilities
Advanced filters: Use attribute and condition-based filters to get the data you require without lengthy PowerShell scripts.
Reports on historical data: PowerShell cmdlets retrieve data no older than seven to 180 days, but M365 Manager Plus can report on all data right from the date of installation.
Customizable dashboard: With M365 Manager Plus' customizable dashboard, you can add graphical representations of reports to help you take a quick look at the mail traffic summary, top email senders and receivers, client device usage, and more. Embed this dashboard in any of your webpages for constant monitoring.
Report scheduler: Reduce the overhead of generating reports manually by scheduling reports to be generated at regular intervals.
Export report: Export reports to PDF, XLSX, HTML, or CSV formats, and email them to anyone who needs them.
Secure delegation: Securely delegate the task of report generation to technicians and IT staff without giving them full access to the Microsoft 365 Admin Center.