I recently had to perform an Office 365 migration for a client with hundreds of users / mailboxes with a terrible assortment of mismatched on-premises Active Directory attributes.

The script below is a script I spent quite a while writing that will fully clean up AD attributes and prepare your users for migration to Office 365 from on-prem Exchange.

The script can be downloaded below, and I’ve posted the raw code as well for review: