How to remove active sync devices for all users after migration to O365

jwcchelpdesk used Ask the Experts™
Exchange 2010
2008R2 DCs

We have always had an issue with FIM not deleting old accounts when they still have active sync devices. We would run a script to remove those activesync devices, then it would complete successfully.

Now that we have migrated from Exchange on prem to Exchange Online, the script fails, but we still continue to have the issue deleting accounts.

If I manually run REMOVE-ACTIVESYNCDEVICES using the GUID on our on-prem Exchange server I get the error. "Couldn't find '' as a recipient."

How can I remove activesync devices from all users now that we are fully migrated to exchange online?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Get-ADObject -filter { ObjectClass -like 'msExchActiveSyncDevices'} -SearchBase “OU=,DC=,DC=” | Remove-ADObject -Recursive

This does what I needed. Hopefully it helps someone else.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial