Powershell script to output shared mailbox information with manager names to CSV using get-mailbox

David Fitzpatrick 21 Reputation points
2021-01-28T04:36:56.617+00:00

My organization converts disabled user mailboxes to shared mailboxes when they depart the company. We currently have approximately 400 departed user shared mailboxes, some of which still have the manager assigned which is causing sync issues. I need to develop a command to output these mailboxes to a CSV and include the manager name, if listed. I'm using the get-mailbox command with the following syntax

Get-Mailbox -RecipientTypeDetails SharedMailbox -ResultSize Unlimited | select PrimarySmtpAddress,DisplayName | export-csv c:\temp\SharedMailboxUsers1.csv

However I can't find the property to retrieve the manager's name, if listed. Is there property or other command I can use to pull this data?

Microsoft 365 and Office Office Online Server
Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2021-01-28T09:34:48.593+00:00

    Hi,

    You can use the Get-Recipient cmdlet

    Get-Recipient -RecipientTypeDetails SharedMailbox -Resultsize unlimited | select PrimarySmtpAddress,DisplayName,Manager  | export-csv c:\temp\SharedMailboxUsers1.csv  
    

    Best Regards,
    Ian Xue

    ============================================

    If the Answer 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.


1 additional answer

Sort by: Most helpful
  1. David Fitzpatrick 21 Reputation points
    2021-01-28T16:12:21.36+00:00

    Thank you Ian! That worked perfectly. Have a great day!

    0 comments No comments

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.