This PowerShell script purge old Exchange ActiveSync devices from an Exchange server.
.\Purge-MobileDevices.ps1 -MinimumAge:90 -FixActiveDirectoryFlag:$falseThe script supports the following parameters:
Sets the minimum age from the device. Default value is 60 days.
Fix the msExchMobileMailboxFlags property from a Active Directory user. Default value is $true.
I a user has no ActiveSync device partnerships anymore, it will set the AD property to 0.