Script: Remove Orphaned ActiveSync Devices

One of the customers is running cleanup of EAS devices. There goal is to remove all devices those haven’t synced with the server for more than 30 days. Approach is like below:

  1. Identify the users who’s activesync devices have not synced over last 30 days.
  2. Notify them about the removal and they should also know what devices are associated with their mailbox those will be removed.
  3. Remove the device after a notification is sent
  4. Log what was removed and who’s mailbox was processed

It is little tedious to do it manually since the initial number of users will be more than 1000, and yes that calls for an automated way to do it. Another reason of automating the process it to avoid any miss of schedule. Humans normally get busy with the things and they forget :). So, I wrote something that will do all mentioned jobs automatically and it goes hereimage

 

What you just need to do is change following information in the script at each of line number mentioned below:

105 – Company Policy Link
148 – Internal Phone Number
150 – External Phone Number
155 – Helpdesk Email Address
176 – Remove -WhatIf parameter
180 – Change the name of Hub Transport Server
143 – Change the name of Hub Transport Server

 

An output email that is sent out looks like below.

 

image

 

Hope you find it useful.

8 thoughts on “Script: Remove Orphaned ActiveSync Devices”

  1. You have in your list of lines to edir line 143 to change HUBCAS, I think this is a misprint.

    Any suggestions on testing this? We don’t have ActiveSync devices in our test environment because it is on an isolated network. Maybe leave the “What-IF” parameter and change the email notifications to send to an Exchange Admin?

    1. @Denton_Geek

      You can try windows mobile simulator for your lab.
      The 143 mentions a transport server not a CAS. Could you elaborate if I misunderstood anything?

Comments are closed.