Remove old EAS Devices

Earlier this month I had to make some cleanups in a customer’s Exchange infrastructure.

On one side, I had to identify empty Distribution Groups and on the other side I had to clean up unused Mobile Devices (Active Sync) partnerships.

The Exchange Organization contains more than 5’000 warm Body (User) Mailboxes from which almost everyone has a Mobile Device.

About the Distribution Group clean up I will write in another Blog entry. Here we will talk about the Active Sync Devices!

If you are an Exchange Engineer you know that a users mostly has more than one active sync device. Mostly an user has one or two phones and a tablet and after some time the user buys a new device and gives away the old one.

Users then do a factory reset and that’s it for them… But the mobile device is still registered in your Exchange Organization.

If you use the PowerShell command:

You can check how many Devices one User has. In my case by about 5’000 warm Body Mailboxes we had over 10’000 mobile devices.

The primary problem is not the amount of the devices, the problem is that old and not longer used devices are still registered in the Exchange Organization.

To clean up all old devices manually by hand is not an option!  So the solution was PowerShell!

First I needed to create a variable for the scope target how long back I want to delete unused devices. For this I defined a variable for ‘Last Sync attempt Time’.

So you can run the script like in the pic bellow:

Collecting the data can take some time! It depends on your Exchange Organization.

After the first collecting, you will see a progress bar wich shows the current status. You can also see details about the progress in the Exchange Management Shell:

After some time the collecting of the information will be done and the script makes a STOP.

After the stop it will automatically open your CSV File which shows you ALL mobile devices which will be removed from your Exchange Organization. Here you have the last chance to modify the entries for the deletion:

After you checked the CSV file, just go back to your Exchange Management Shell and press ENTER.

Now the removal progress starts:

At the end you will get the notice that the defined mobile devices were deleted.

So now you’re done… Almost! The Script also creates two Log Files, one for the successful removes and one for the errors. These files will be saved in the script path.

Now you are done with removing the old mobile devices…

I hope this script will help you with your operational tasks and you will enjoy it.

The last question is, where can you download this script?

You can find it in the Technet Gallery.

 

 

 

 

Photo by Michael Dziedzic on Unsplash


Leave a Reply

Your email address will not be published. Required fields are marked *