Skip to main content

Use cases

Create a Powershell Script to list Office 365 Shared Mailboxes

The following Powershell script connects to Office 365 and exports all Shared Mailboxes:

$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session
Get-Recipient -RecipientTypeDetails SharedMailbox > SharedMailboxes.txt
Remove-PSSession $Session

The script will create a file called Sharedmailboxes.txt which contains a list of Shared Mailboxes.