Entra / Microsoft 365 · Exchange Online
Report mailbox folder assistant activity
List mailboxes and the last time the Mailbox Folder Assistant processed each mailbox.
Connect & set up
Run these once per session. All scopes are read-only unless the script makes changes.
# Review required modules and connection steps before running.# Connect to Microsoft Graph or Exchange Online as needed for this script.
Run it
The main script. Copy it, or download the .ps1 and run it from your console.
$Mbx = Get-ExoMailbox -RecipientTypeDetails UserMailbox -ResultSize Unlimited$Report = [System.Collections.Generic.List[Object]]::new() # Create output fileWrite-Host "Fetching details of user mailboxes..."ForEach ($M in $Mbx) {$LastProcessed = $NullWrite-Host "Processing" $M.DisplayName$Log = Export-MailboxDiagnosticLogs -Identity $M.Alias -ExtendedProperties$xml = [xml]($Log.MailboxLog)$LastProcessed = ($xml.Properties.MailboxTable.Property | ? {$_.Name -like "*ELCLastSuccessTimestamp*"}).Value$ItemsDeleted = $xml.Properties.MailboxTable.Property | ? {$_.Name -like "*ElcLastRunDeletedFromRootItemCount*"}If ($LastProcessed -eq $Null) {$LastProcessed = "Not processed"}$ReportLine = [PSCustomObject][Ordered]@{User = $M.DisplayNameLastProcessed = $LastProcessedItemsDeleted = $ItemsDeleted.Value}$Report.Add($ReportLine)}$Report | Select User, LastProcessed, ItemsDeleted$Report | Out-GridView
Attribution
Author
Office365itpros