Here is another script from the Quick and Dirty category. The script reads all permissions for all folders within the mailboxes of the Exchange organization and saves them in a CSV file for further analysis. Maybe someone can use it or even put it into a reasonable form.
# All mailbox folders in your authorizations for
# Read all mailboxes and write to CSV file
#
# written by Frank Zöchling
# www.frankysweb.de#—————————————————–
# Enter CSV file and path here:
$outfile = „d:\test\report.csv“#—————————————————–
$entireforest = Set-ADServerSettings -ViewEntireForest $true
$mailboxes = get-mailboxdatabase | get-mailbox
„Postfach;Ordnerpfad;Benzuter;Rechte“ | set-content $outfileforeach ($mailbox in $mailboxes)
{
$folders = Get-MailboxFolderStatistics $mailbox | ForEach-Object {$_.FolderPath}
foreach ($folder in $folders)
{
$alias = $mailbox.Alias
$folderpath = $alias + „:“ + $folder
$folderpath = $folderpath -replace „/“,“\“
$folderaccessrights = Get-MailboxFolderPermission $folderpath -ErrorAction silentlycontinue
foreach ($folderaccessright in $folderaccessrights)
{
$accessright = $folderaccessright.AccessRights
$accessuser = $folderaccessright.Identity
„$mailbox;$folderpath;$accessuser;$accessright“ | add-content $outfile
}
}
}
Line 25 contains "-ErrorAction silentlycontinue", the parameter suppresses errors on the console, as not all authorizations can be read, for example the Dumpster folders (version, purge etc). However, the folders are still listed in the CSV.