This is the script that I created to extract the permissions of all the calendars in an Exchange organization.
The script searches in each mailbox the folders of type “Calendar” and, for each of them, extracts its permissions, the result is output to a csv file.
$mailbox_list = Get-Mailbox -Resultsize Unlimited
foreach ($mailbox in $mailbox_list)
{
$calendari = $mailbox | Get-MailboxFolderStatistics | Where {$_.foldertype -eq “Calendar”}
foreach ($ Calendar $ calendars)
{
[string]$ID_calendario = $mailbox.PrimarySmtpAddress
$ ID_calendario + = “:\”
$ ID_calendario + = $ calendario.nameGet-MailboxFolderPermission $ID_calendario | select identity,foldername,user,@{name=”AccessRights”;expression={ [string]::join(“,”,@($_.accessrights)) }} | Export-Csv c:tempout.csv -Append
}
}
The output is in the format:
#TYPE Selected.Microsoft.Exchange.Management.StoreTasks.MailboxFolderPermission
“Identity”,”FolderName”,”User”,”AccessRights”
“domain.local/BigPharma Spa/Mario Rossi:Calendar”,”Calendar”,”Giorgio Giorgetti”,”Reviewer”
“domain.local/BigPharma Spa/Mario Rossi:Calendar”,”Calendar”,”Fabio Guidetti”,”Reviewer”
“domain.local/BigPharma Spa/Mario Rossi:Calendar”,”Calendar”,”Monica saplings”,”Reviewer”
“domain.local/BigPharma Spa/Mario Rossi:Calendar”,”Calendar”,”Maria Moria”,”Reviewer”
“domain.local/BigPharma Spa/Mario Rossi:Calendar”,”Calendar”,”Guido Marchesini”,”Reviewer”
“domain.local/BigPharma Spa/Marco Verdi:Calendar”,”Calendar”,”Default”,”AvailabilityOnly”