Skip to content

Instantly share code, notes, and snippets.

@almightyju
Created February 7, 2020 17:07
Show Gist options
  • Save almightyju/425468af74ad97fb30c728749fd0fc3b to your computer and use it in GitHub Desktop.
Save almightyju/425468af74ad97fb30c728749fd0fc3b to your computer and use it in GitHub Desktop.
Get-Mailbox -RecipientTypeDetails SharedMailbox -ResultSize:Unlimited `
| Select PrimarySmtpAddress,Alias,DisplayName `
| sort displayname `
| select-object PrimarySmtpAddress, DisplayName, @{
Name = "Users With Access";
Expression = {
Get-MailboxPermission -Identity $_.alias `
| ? { $_.user -like "*@*" } `
| select -expandproperty User `
| &{"$input"}
}
} | Export-Csv .\sharedmailboxes.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment