PowerShell – List all users that have access to other mailboxes in Exchange

One of my previous customers was a company in the financial sector. Such companies have several compliancy rules and much “evidence” needs to be gathered to prove that they are compliant.

They implemented SCOM which can monitor a lot, yet still some specific reports needed to be made.
I’m not that much of a SCOM guru and that’s why I turned to PowerShell.
The request.
Create a report every night where all mailbox access is reported, specifically who has access to mailboxes other than their own and which level of access they have… and of course which mailbox it is.

Here’s the script (yes, it’s a one-liner again):

Get-Mailbox | Get-MailboxPermission | where {$_.user.tostring() -ne “NT AUTHORITY\SELF” -and $_.IsInherited -eq $false} | Select Identity,User,@{Name=’Access Rights’;Expression={[string]::join(‘, ‘, $_.AccessRights)}} | Export-Csv -NoTypeInformation mailboxpermissions.csv

3 comments

  1. hans straat says:

    nice one Jeff. I retweeted it already

  2. Alan Byrne says:

    Hi Jeff, I keep meaning to get myself trained and educated on powershell because its importance when working with MSFT technologies is growing and growing, and becoming more important with each product release.  What would be your advise to get trained and up to spped with powershell asap?  Thanks @alanbyrne:twitter 

  3. Jeff Wouters says:

    Hi Alan,

    For me to provide specific information I would need to know which product or area you want to focus on.
    But To start with the basic skills, here are some books that can help you get started:
    http://www.amazon.com/Windows-PowerShell-2-0-Don-Jones/dp/0982131429/ref=sr_1_1?s=books&ie=UTF8&qid=1321963364&sr=1-1
    http://www.amazon.com/Learn-Windows-PowerShell-Month-Lunches/dp/1617290211/ref=sr_1_1?s=books&ie=UTF8&qid=1321963396&sr=1-1

    And you could follow some peeps on Twitter that provide lots of good and handy information. I know of a few, such as @jeffhicks:twitter @powertip:twitter  @powershellguru:twitter and of course @jimposhible:twitter .
    Next to that, I started by following the hashtag #powershell for about a month and you’ll soon notice who to follow ( for your specific focus area).

    Good luck! And hope to come across one of your post 🙂

    Jeff.

Leave a Reply

Your email address will not be published. Required fields are marked *