DirSync Change: Forcing/Manual Syncs

So up until the latest version of the DirSync tool (at the time of this writing version 6862.0000), in order to force a sync, we first had launch a Windows Powershell 2.0 console on the respective server and then navigate to “C:\Program Files\Microsoft Online Directory Sync” or “C:\Program Files\Windows Azure Directory Sync” folder (depending on version in use) and from here run the “DirSyncConfigshell.psc1” script followed by running the actual “Start-OnlineCoexistenceSync” cmdlet that initiates the sync itself.

Image

image

 

With version 6862.0000, we still use the “Start-OnlineCoexistenceSync” cmdlet to initiate the actual sync. However, in order to run this cmdlet, instead of executing the “DirSyncConfigshell.psc1” script, we must use one of the following methods:

Method 1
Open Windows PowerShell and use the “Import-Modules.ps1” script which is located in the “DirSync” sub-folder.

Image

Method 2
Open Windows PowerShell and then run “Import-Module Dirsync”.

Image

A small but nonetheless important change to be aware of. Especially if you have and identity management solution that includes logic that force a sync after a new user has been provisioned/updated/etc.

Thanks to Brian Reid for the tip about method 2!

 

Until later,
Henrik Walther

5 thoughts on “DirSync Change: Forcing/Manual Syncs”

  1. I have the same problem yesterday….

    To force a synchronization DirSync version (1.0.6862.0000)

    1. Run PowerShell console as Administrator

    2. Change folder to C:Program FilesWindows Azure Active Directory Sync

    3. Type Import-Module DirSync

    4. Run Start-OnlineCoexistenceSync

  2. It's baffling that MS removed the Powershell module and just gave us a commandline tool. Hello automation and scripting?!

    I was unable to make Powershell that calls the DirectorySyncClientCmd.exe work, when executed via webservice hosted on IIS. Instead, I solved it by using the TaskScheduler library found here: http://taskscheduler.codeplex.com . This allows you to start the "Azure AD Sync Scheduler" scheduled task on the server you installed the Azure admin tools on. Here's a code example in C#:

    using (TaskService service = new TaskService("addirsyncservername", "username", "domain", "password"))
    {
    Microsoft.Win32.TaskScheduler.Task task = service.GetTask("Azure AD Sync Scheduler");
    task.Run();

    while (task.State == TaskState.Running)
    {
    Thread.Sleep(1000);
    }
    }

  3. I want to put the following commands in a .bat or vb script. Can someone help with that?

    To force a synchronization DirSync version (1.0.6862.0000)

    1. Run PowerShell console as Administrator

    2. Change folder to C:Program FilesWindows Azure Active Directory Sync

    3. Type Import-Module DirSync

    4. Run Start-OnlineCoexistenceSync

Leave a Comment

Your email address will not be published.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top