Export users with access to other mailboxes

Christian Hans
Christian Hans used Ask the Experts™
on
Morning all,

I am looking for a command or script that will allow me to export a csv showing the mailbox in one column, then in the next column(s) show names of the users that have access to said mailbox.

I've been trying to alter this one that I found online, with no luck, the User field is blank:

$a = Get-Mailbox -ResultSize Unlimited
$a | Get-MailboxPermission | Where { ($_.IsInherited -eq $False) -and -not ($_.User -like “NT AUTHORITY\SELF”) -and -not ($_.User -like '*Discovery Management*') } | Select Identity,@{name="User";expression={(Get-User $_.User).User}},AccessRights | Export-CSV c:\Temp\output.csv -NoTypeInformation
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
IT Systems Analyst
Commented:
Here is the script I use to get that task accomplished:
Get-Mailbox | Get-MailboxPermission | where {$_.user.tostring() -ne "NT AUTHORITYSELF" -and $_.IsInherited -eq $false} | Select Identity,User,@{Name='Access Rights';Expression={[string]::join(', ', $_.AccessRights)}} | Export-Csv -NoTypeInformation mailboxpermissions.csv

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial