Not going to go into much detail on why this is needed just wanted to provide a quick and easy solution to automate this task via PowerShell. If you plan on leveraging this to handle forest migrations and plan to use the MS-DS-ConsistencyGuid as a source anchor in Azure AD make sure to research these changes first and test. Azure AD Connect will require some configuration that wont be covered in this post.
This script sample can be ran as a schedule task or just ran by an admin as needed. This cmdlet will only update group and user objects that’s MS-DS-ConsistencyGuid attribute contain no value. Unlike most of my scripts I am not looping through the domains in a forest.
Use this to verify it worked