forked from 12Knocksinna/Office365itpros
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMFAReportMailboxes.ps1
20 lines (20 loc) · 972 Bytes
/
MFAReportMailboxes.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# MFAReportMailboxes.ps1
# List mailboxes and the last time MFA processed each mailbox
$Mbx = Get-Mailbox -RecipientTypeDetails UserMailbox -ResultSize Unlimited
$Report = @()
ForEach ($M in $Mbx) {
$LastProcessed = $Null
Write-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.DisplayName
LastProcessed = $LastProcessed
ItemsDeleted = $ItemsDeleted.Value}
$Report += $ReportLine
}
$Report | Select User, LastProcessed, ItemsDeleted