Get All Public Folders and Permissions using PowerShell  

Get All Public Folders and Permissions using PowerShell

Public folders are used to organize and share information with people inside the organization. Users can create public folders and share them with other users by assigning permission. This blog provides PowerShell code examples to list all public folders and get the permission applied to them.

You must connect to Exchange Online PowerShell using the EXO V2 module before using the public folder PowerShell cmdlets.

Public Folders Report:

To list all the public folders in your organization, run the Get-PublicFolder cmdlet.

Get-PublicFolder –Recurse –ResultSize Unlimited  

It will list all the public folders and their subfolders.

To view a specific public folder and its subfolders, run the cmdlet.

Get-PublicFolder –Identity “Marketing” -Recurse –ResultSize Unlimited  

Get Mail Enabled Public Folders:

You can use public folders as an archiving method for distribution groups. It can be achieved by mail-enabling a public folder and adding it as a member of the distribution group. As a result, email sent to the group is automatically stored in the public folder for future reference.
To view mail-enabled public folder, execute the cmdlet as below.

Get-PublicFolder -Recurse –ResultSize Unlimited | where{$_.MailEnabled -eq $true} 

Get Public Folder Size using PowerShell:

You can use the below cmdlet to check public folder size.

Get-PublicFolder -Recurse –ResultSize Unlimited |Select Name, ParentPath,FolderSize 

To get public folder size, including subfolders, run the following cmdlet.

Get-PublicFolder <FolderIdentity> -Recurse –ResultSize Unlimited | Get-PublicFolderStatistics |Measure TotalItemSize –Sum 

To get the total size of all the public folders, use the below cmdlet.

Get-PublicFolderStatistics -ResultSize Unlimited | Measure-Object -Property TotalItemSize -Sum 

Here, the Count shows the number of public folders in your organization, and the Sum shows the total item size.

Get public folder statistics using PowerShell

Get Public Folder Statistics and Export to CSV:

You can use the Get-PublicFolderStatistics cmdlet to retrieve statistical information about public folders.

Get-PublicFolderStatistics –Identity <FolderIdentity> 

It will show creation time, last modification time, total item size, total deleted item size, etc.

To export all the public folders’ statistics, run the below cmdlet.

Get-PublicFolder -Recurse –ResultSize Unlimited | Get-PublicFolderStatistics | select Name,TotalItemSize,TotalDeletedItemSize,LastModificationTime | Export-Csv <FilePath> -NoType 

View Public Folder Items:

Run the Get-PublicFolderItemStatistics cmdlet to view statistics for public folder items. For example,

Get-PublicFolderItemStatistics –Identity <FolderIdentity> 

By using this cmdlet, you can view the type of item, subject, last user modification time, last user access time, creation time, attachments, and message size.

Get Public Folder Permission Report:

To view permission on a specific public folder, run the following cmdlet.

Get-PublicFolderClientPermission -Identity <FolderIdentity> | Select User,AccessRights 

Get Office 365 public folder permission PowerShell

To get all public folders and permissions using PowerShell, execute the cmdlet below.

Get-PublicFolder -Recurse -ResultSize Unlimited | Get-PublicFolderClientPermission 

It will list public folder permissions, including default and anonymous.

I hope this blog will help you generate Microsoft 365 public folder reports. You can ask your queries through the comment section. We all have ears!

Get All Public Folders and Permissions using PowerShell  

by Kathy time to read: 2 min
0