How to check last run of Mailboxes’ Managed Folder Assistants.

WrongRetentionPolicy.jpg

Let’s say you have published wrong retention policy and you would like to check which mailboxes got this policy applied. To check when the last run of Mailboxes’ Managed Folder Assistant took place you might use below simple script – it is a mess but I’m sure you guys will retrieve from it what you want ^^.

Fill $TimeFrom with the time when you created the policy so you got all the mailboxes that got the policy after that time.

$AllMailboxes = Get-mailbox -ResultSize unlimited
$TimeFrom = "24.10.2018 07:00:00"
$mailboxcount = $AllMailboxes.count
ForEach ($Mailbox in $AllMailboxes){

$i = $i + 1
$pct = $i/$mailboxcount * 100
Write-Progress -Activity "Collecting mailbox details" -Status "Processing mailbox $i of $mailboxcount - $Mailbox" -PercentComplete $pct

$ElcProps = Export-MailboxDiagnosticLogs $Mailbox.primarysmtpaddress -ExtendedProperties
$xmlprops = [xml]($ElcProps.MailboxLog)
$timestamp = ($xmlprops.Properties.MailboxTable.Property | where {$_.Name -like "ELCLastSuccessTimestamp"}).value
if ((get-date $timestamp) -gt (get-date $TimeFrom)){
write-host $Mailbox.Alias"#$timestamp"
}
}

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s