MVP - Most Valuable Professional

Just can't get enough of IT

This blog is about mostly anything in IT. But the primary focuses are Microsoft technologies like Exchange Server, Microsoft 365, Microsoft Teams, and Cloud Security.

Cleanup ActiveSync device partnerships


This script removes orphaned ActiveSync device partnerships from Exchange Server 2010 user mailboxes. Run the script as a scheduled job to maintain your Exchange Server environment properly.

Modifiy the script path variables to fit your requirements. The variables are configured in the ### BEGIN Variables section.

Steps being executed by the script:

  1. Fetch all user mailboxes
  2. Iterate through each user mailbox and determine the number of ActiveSync devices and the number of devices which have not synchronized since 150 days
  3. Delete ActiveSync device registration, if a user has more than 4 devices in total and a minimum of 1 device that has not synced within 150 days



Version History

  • 1.0, Initial community release


Additional Credits

Additional credits go to Sebastian Rubertus




Comments are closed.

Showing 1 Comment

  1. Avatar
    Posted By [Pingback] 5 years ago
    Pingback from

    Just can't get enough...