Get all Public Folders and Permissions using Powershell, in this article, you will get steps to steps process of how to Get all Public Folders and Permissions using Powershell.
Public folders are widely used in Microsoft Exchange Server and Microsoft 365 (formerly Office 365) to facilitate information sharing within organizations. Managing public folders and their permissions effectively is crucial for maintaining data security and accessibility.
PowerShell, with its robust scripting capabilities, provides a convenient way to retrieve public folders and their associated permissions. In this article, we will explore how to use PowerShell to retrieve all public folders and their permissions effortlessly, as well as how to retrieve details for a specific public folder.

Table of Contents
Prerequisites
To follow the steps in this article, you will need:
- A Windows computer with PowerShell installed.
- Administrative access to the Exchange Server or Microsoft 365 environment.
Get all Public Folders and Permissions using Powershell
Below are steps for Get all Public Folders and Permissions using PowerShell –
Step 1: Connect to Exchange Server or Microsoft 365
Open PowerShell with administrative privileges and connect to your Exchange Server or Microsoft 365 environment using the following commands:
# For connecting to an on-premises Exchange Server
$ExchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://<ExchangeServer>/PowerShell/ -Authentication Kerberos
Import-PSSession $ExchangeSession -DisableNameChecking
# For connecting to Microsoft 365 (Exchange Online)
$ExchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://outlook.office365.com/powershell-liveid/" -Credential (Get-Credential) -Authentication Basic -AllowRedirection
Import-PSSession $ExchangeSession -DisableNameChecking
Step 2: Retrieve Public Folders
After connecting to the Exchange Server or Microsoft 365 environment, use the following PowerShell command to retrieve all public folders:
Get-PublicFolder -Recurse | Select Name, Identity
This command will display a list of all public folders along with their names and identities, facilitating easy identification and management.
Step 3: Get Public Folder Permissions
To retrieve the permissions associated with each public folder, use the Get-PublicFolderClientPermission
cmdlet. This cmdlet retrieves the access control list (ACL) for each public folder and displays the users or groups with their corresponding permissions.
Get-PublicFolder -Recurse | ForEach-Object {
$folder = $_
Get-PublicFolderClientPermission -Identity $folder.Identity | Select-Object @{Name="Folder";Expression={$folder.Name}}, User, AccessRights
}
Running this command will generate a list of public folders along with the users or groups and their respective access rights.
Step 4: Retrieve Details for a Specific Public Folder
To retrieve specific details for a particular public folder, use the Get-PublicFolder
cmdlet with the -Identity
parameter. Simply provide the identity or name of the folder you want to query, and the cmdlet will return the details.
Get-PublicFolder -Identity "<FolderIdentity>"
Replace <FolderIdentity>
with the identity or name of the specific public folder, in which you want to retrieve details.
Step 5: Export the Results
If you want to export the results to a CSV file for further analysis or documentation, modify the previous commands to include the Export-Csv
cmdlet. Here’s an example:
Get-PublicFolder -Recurse | ForEach-Object {
$folder = $_
Get-PublicFolderClientPermission -Identity $folder.Identity | Select-Object @{Name="Folder";Expression={$folder.Name}}, User, AccessRights
} | Export-Csv -Path "C:\PublicFolders.csv" -NoTypeInformation
This command will save the results to a CSV file named “PublicFolders.csv” at the specified path.
By following the above steps you will get all Public Folders and Permissions using PowerShell.
Conclusion
PowerShell provides an efficient means of get all Public Folders and Permissions using powershell. By following a few simple steps, administrators can obtain critical information such as folder names, identities, user groups, and access rights. Additionally, PowerShell allows the retrieval of specific details for a particular public folder using the Get-PublicFolder
cmdlet. Automation of these processes empowers IT professionals to effectively manage and monitor the security and accessibility of public folders within their organization.
Visit Latestinfo365.com to check more article