Office 365 – List members of Shared Mailboxes

List members of Shared Mailboxes (Microsoft 365)

1. Connect to Office 365 PowerShell, run the PowerShell ISE as Administrator and execute the following command:

Set-ExecutionPolicy RemoteSigned
$Cred = Get-Credential

2. Type your user ID and password in the Windows PowerShell Credential Request and click OK.

3. Create a session using the following command, modifying –ConnectionUri parameter based on your Exchange Online location:

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $Cred -Authentication Basic –AllowRedirection

4. Connect to Exchange Online:

Import-PSSession $Session –DisableNameChecking

5. Copy and run the following script, adjusting the filters for the specific user you want to report on and specifying the desired path for the CSV file output:

Get-Mailbox -RecipientTypeDetails SharedMailbox -ResultSize:Unlimited | Get-MailboxPermission |Select-Object Identity,User,AccessRights | Where-Object {($_.user -like ‘*@*’)}|Export-Csv C:\Temp\sharedfolders.csv  -NoTypeInformation 

6. Review the resulting CSV report:

7. Terminate your session with following cmdlet:

Remove-PSSession$Session