Export Public folder permission

Austin Sundar 436 Reputation points
2020-10-18T14:27:59.253+00:00

I am trying to export public folder permission with the user's email address. Using the below script I can get the details of AccessRights and User name. Can anyone help, how to add the user’s email address to the script?

Get-PublicFolder -Recurse -resultsize unlimited | Get-PublicFolderClientPermission | Select-Object Identity,@{Expression={$.User};Label="User";},@{Expression={$.AccessRights};Label="AccessRights";} | Export-Csv C:\PublicFolderClientPermission.csv

Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
7,583 questions
0 comments No comments
{count} votes

Accepted answer
  1. Lydia Zhou - MSFT 2,376 Reputation points Microsoft Employee
    2020-10-21T01:51:46.793+00:00

    @Austin Sundar

    I modified the command again, and it works on my Exchange 2010 SP3 ru30. Please try it on your Exchange server:

    Get-PublicFolder -Recurse -resultsize unlimited | Get-PublicFolderClientPermission | Select-Object Identity,@{Expression={$_.User};Label="User"},@{Name='AccessRights';Expression={[string]::join(', ', $_.AccessRights)}},@{label="PrimarySmtpAddress";expression={(Get-Mailbox $_.User.tostring()).PrimarySmtpAddress}}|export-csv C:\location\pubpermission.csv -NoTypeInformation  
    

    This my output:
    33805-592.png

    33892-591.png

    Additionally, since Exchange 2010 is end of support, we suggest to migrate to Office 365 or Exchange 2016 for better services. For your reference: Exchange 2010 end of support roadmap.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


3 additional answers

Sort by: Most helpful
  1. Vasil Michev 103.4K Reputation points MVP
    2020-10-18T14:55:27.133+00:00

    You can try something like this:

    Get-PublicFolder -Recurse -resultsize unlimited | Get-PublicFolderClientPermission | Select-Object Identity,@{e={$_.User};Label="User"},@{e={$_.User.RecipientPrincipal.PrimarySmtpAddress};Label="Email"},@{Expression={$.AccessRights};Label="AccessRights";} | Export-Csv C:\PublicFolderClientPermission.csv
    

    I've tested it against ExO only, but something similar should work for on-prem Exchange too.


  2. Lydia Zhou - MSFT 2,376 Reputation points Microsoft Employee
    2020-10-19T02:46:22.503+00:00

    @Austin Sundar

    I made some modification on your command, and you can use the following command to get needed information:

    Get-PublicFolder -Recurse -resultsize unlimited | Get-PublicFolderClientPermission | Select-Object Identity,@{Expression={$_.User};Label="User"},@{Name='AccessRights';Expression={[string]::join(', ', $_.AccessRights)}},@{label="PrimarySmtpAddress";expression={(Get-Mailbox $_.User.displayname).PrimarySmtpAddress}}|export-csv C:\location\pubpermission.csv -NoTypeInformation  
    

    Here is my test result:
    33222-587.png

    This is my .csv file:
    33223-588.png


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  3. Lydia Zhou - MSFT 2,376 Reputation points Microsoft Employee
    2020-10-20T01:34:49.833+00:00

    What's the detailed version of your Exchange servers?
    What's the output of the command without exporting?

    Get-PublicFolder -Recurse -resultsize unlimited | Get-PublicFolderClientPermission | Select-Object Identity,@{Expression={$_.User};Label="User"},@{Name='AccessRights';Expression={[string]::join(', ', $_.AccessRights)}},@{label="PrimarySmtpAddress";expression={(Get-Mailbox $_.User.displayname).PrimarySmtpAddress}}  
    

    This is my output. You can post your result here, and don't forget to cover personal information.
    33326-589.png


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.