Using the Exchange Management Console, you can easily identify ActiveSync devices which are out of sync for a period of time. This is just a re-hash of multiple other posts, but I still think that the way in which I identify the devices is unique. I used only one variable in this script; $Days – which is the number of days out of contact before the devices become relevant to this report.
Please be patient as this does take a significant amount of time to execute if you have a large environment.
if ( -not ( Get-Command -Name Get-CASMailbox -ErrorAction SilentlyContinue ) )
{
Add-PSSnapin -Name Microsoft.Exchange.Management.PowerShell.E2010 -ErrorAction SilentlyContinue
}
$Days = 60
$ActiveSyncMailboxes = Get-CASMailbox -ResultSize Unlimited | Where-Object { $_.HasActiveSyncDevicePartnership }
$ActiveSyncReport = $ActiveSyncMailboxes | ForEach-Object { Get-ActiveSyncDevice -Mailbox ( $_.Name ) -ResultSize Unlimited }
$ActiveSyncReport | Add-Member -MemberType ScriptProperty -Name LastSuccessSync -Value { ( Get-ActiveSyncDeviceStatistics -Identity $this ).LastSuccessSync } -Force
$InactiveDevices = $ActiveSyncReport | Where-Object { $_.LastSuccessSync -lt ( Get-Date ).AddDays(-$Days) } | Out-GridView