{"id":314,"date":"2021-08-17T08:37:48","date_gmt":"2021-08-17T12:37:48","guid":{"rendered":"http:\/\/www.thelamberts.com\/wiki\/?p=314"},"modified":"2021-08-17T08:37:49","modified_gmt":"2021-08-17T12:37:49","slug":"report-of-non-standard-permissions-exchange-online","status":"publish","type":"post","link":"http:\/\/www.thelamberts.com\/wiki\/2021\/08\/17\/report-of-non-standard-permissions-exchange-online\/","title":{"rendered":"Report of non-standard permissions  Exchange Online"},"content":{"rendered":"<pre class=\"brush: powershell; title: ; notranslate\" title=\"\"># ReportPermissionsOnMailboxes.PS1\n# https:\/\/github.com\/12Knocksinna\/Office365itpros\/edit\/master\/ReportPermissionsOnMailboxes.PS1\n# Quick and simple script to generate a report of non-standard permissions applied to Exchange Online user and shared mailboxes\n# Needs to be connected to Exchange Online PowerShell with an administrative account to run\n# V1.0 25-Feb-2020\nCLS\nWrite-Host &quot;Fetching mailboxes&quot;\n$Mbx = Get-ExoMailbox -RecipientTypeDetails UserMailbox, SharedMailbox -Properties RecipientTypeDetails -ResultSize Unlimited\n\nIf ($Mbx.Count -eq 0) { Write-Error &quot;No mailboxes found. Script exiting...&quot; -ErrorAction Stop } \n# We have some mailboxes, so we can process them...\nCLS\n$Report = &#x5B;System.Collections.Generic.List&#x5B;Object]]::new() # Create output file \n$ProgressDelta = 100\/($Mbx.count); $PercentComplete = 0; $MbxNumber = 0\nForEach ($M in $Mbx) {\n    $MbxNumber++\n    $MbxStatus = $M.DisplayName + &quot; &#x5B;&quot;+ $MbxNumber +&quot;\/&quot; + $Mbx.Count + &quot;]&quot;\n    Write-Progress -Activity &quot;Processing mailbox&quot; -Status $MbxStatus -PercentComplete $PercentComplete\n    $PercentComplete += $ProgressDelta\n    # REST cmdlet equivalent\n    # $Permissions = Get-ExoMailboxPermission -Identity $M.UserPrincipalName | ?  {$_.User -Like &quot;*@*&quot; }   \n    $Permissions = Get-MailboxPermission -Identity $M.UserPrincipalName | ? {$_.User -Like &quot;*@*&quot; }    \n    If ($Null -ne $Permissions) {\n       # Grab each permission and output it into the report\n       ForEach ($Permission in $Permissions) {\n         $ReportLine  = &#x5B;PSCustomObject] @{\n           Mailbox    = $M.DisplayName\n           UPN        = $M.UserPrincipalName\n           Permission = $Permission | Select -ExpandProperty AccessRights\n           AssignedTo = $Permission.User\n           MailboxType = $M.RecipientTypeDetails } \n         $Report.Add($ReportLine) }\n     } \n}     \n$Report | Sort -Property @{Expression = {$_.MailboxType}; Ascending= $False}, Mailbox | Export-CSV c:\\temp\\MailboxPermissions.csv -NoTypeInformation\nWrite-Host &quot;All done.&quot; $Mbx.Count &quot;mailboxes scanned. Report of non-standard permissions available in c:\\temp\\MailboxPermissions.csv&quot;\n\n# An example script used to illustrate a concept. More information about the topic can be found in the Office 365 for IT Pros eBook https:\/\/gum.co\/O365IT\/\n# and\/or a relevant article on https:\/\/office365itpros.com or https:\/\/www.petri.com. See our post about the Office 365 for IT Pros repository # https:\/\/office365itpros.com\/office-365-github-repository\/ for information about the scripts we write.\n\n# Do not use our scripts in production until you are satisfied that the code meets the need of your organization. Never run any code downloaded from the Internet without\n# first validating the code in a non-production environment.e<\/pre>\n<p>https:\/\/office365itpros.com\/2020\/03\/16\/creating-report-exchange-online-mailbox-permissions\/<\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,3],"tags":[],"class_list":["post-314","post","type-post","status-publish","format-standard","hentry","category-exchange","category-powershell"],"_links":{"self":[{"href":"http:\/\/www.thelamberts.com\/wiki\/wp-json\/wp\/v2\/posts\/314","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.thelamberts.com\/wiki\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.thelamberts.com\/wiki\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.thelamberts.com\/wiki\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.thelamberts.com\/wiki\/wp-json\/wp\/v2\/comments?post=314"}],"version-history":[{"count":6,"href":"http:\/\/www.thelamberts.com\/wiki\/wp-json\/wp\/v2\/posts\/314\/revisions"}],"predecessor-version":[{"id":320,"href":"http:\/\/www.thelamberts.com\/wiki\/wp-json\/wp\/v2\/posts\/314\/revisions\/320"}],"wp:attachment":[{"href":"http:\/\/www.thelamberts.com\/wiki\/wp-json\/wp\/v2\/media?parent=314"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.thelamberts.com\/wiki\/wp-json\/wp\/v2\/categories?post=314"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.thelamberts.com\/wiki\/wp-json\/wp\/v2\/tags?post=314"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}