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.

May 10, 2012   Posted in: Uncategorized

8 Responses

  1. Shawn - May 10, 2012

    Great script Milind. Keep up the good work.

  2. Milind Naphade - May 10, 2012

    Thanks Shawn. :)

  3. Charles Derber - May 10, 2012

    Nice task & well approached just as the password expired alert :)

  4. Ratish Nair - May 11, 2012

    Terrific one…

  5. Milind Naphade - May 11, 2012

    Thanks Ratish

  6. Milind Naphade - May 11, 2012

    Glad to hear that Charles. Thank you.

  7. Denton_Geek - June 4, 2012

    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?

  8. Milind Naphade - June 9, 2012

    @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?


%d bloggers like this: