Collecting mailbox and calendar permissions In Exchange

I’ve came up with some PowerShell inventory commands a while ago and thought, why wouldn’t I share it with the world?

Well I’m doing it now.

These PowerShell commands can come in handy when you are migrating mailboxes without the possibility of setting up a Hybrid Exchange setup. I’ve had some customers who where migrating their mailboxes of a shared hosted workspace where setting up a Hybrid Exchange environment wasn’t possible.

To keep the existing mailbox and calendar permissions in place I needed to collect all the current permissions from the Exchange server.

You can run the following commands on the Exchange server in order to collect the permissions:

Getting the root domain and all the mailboxes



Collecting all the mailbox permissions

$mailboxpermissions=foreach ($user in $all) {get-mailboxpermission -Identity $user.alias | where {$_.IsInherited -ne “True” -and $_.User -notlike “$domain\Domain*” -and $_.User -notlike “$domain\Admin*” -and $_.User -notlike “NT AUTHORITY\*”}}

$mailboxpermissions| select Identity,User,AccessRights

Collecting the calendar permissions

$calendarpermissions=foreach ($user in $all) {get-mailboxfolderpermission -identity $user”:\”calendar | where {$_.User -notlike “Default” -and $_.User -notlike “Anonymous” -and $_.User -notlike “*$user.Name*”}}

$calendarpermissions | select Identity,User,AccessRights,Foldername

This will give you an overview of all the permissions and of course you can export them to CSV like so:

$calendarpermissions | export-csv -path C:\Enter-a-path\Calendar_Permissions.csv

$mailboxpermissions | export-csv -path C:\Enter-a-path\Mailbox_Permissions.csv

Dit vind je misschien ook leuk...

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *

%d bloggers liken dit: