Force Directory Synchronization between Active Directory and Office 365 using PowerShell

Hi all,

There may be times when you need a change that was made in your on premises Active Directory to be immediately synchronized rather than waiting 3 hours for the next sync. For example, a user is removed from Active Directory or a change in an attribute such as a user’s Title was made. There is a quick and easy way to do this using PowerShell following the instructions in this blog.

First, you will need to log on the server where the Microsoft Online Directory Synchronization Tool was installed and open PowerShell as Administrator. Navigate to the ”C:\Program Files\Microsoft Online Directory Sync” as shown below.

Next type the following command and press enter to execute the “PowerShell Console File”:

.\DirSyncConfigShell.psc1

A second PowerShell window will open as shown below.

In the new window type the following command and press enter:

Start-OnlineCoexistenceSync

Now open the Event Viewer and navigate to the Application log and you will see event for Directory Synchronization as shown below.

If you will open Event ID 4 you will see that the export has completed as shown in the following illustration.

You can also login to the Office 365 Portal and verify the changes there as well.

I hope this helps. As always, if you have any questions or feedback, please leave a comment.

Leave a Reply

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