Update 2 – February 24th 2016 – The new February AD Connect release has no schedule task anymore. So we now have a new command in the ADSync module – Start-ADSyncSyncCycle.
To initiate a synchronization locally or remotely (if enabled) , you could run the following command for example:
Invoke-Command -ComputerName DirSync-Server.domain.com -ScriptBlock {& Import-Module ADSync;Start-ADSyncSyncCycle}
Update – July 7th 2015 – For those who have installed the latest AADSync – Azure Active Directory Sync or AD Connect – Azure Active Directory Connect
There has been another change to the module name, it is now ADSync. and the great news is that forcing replication will no longer be a PowerShell cmdlet.
To initiate a synchronization locally or remotely (if enabled) , you could run the following command for example:
Invoke-Command -ComputerName DirSync-Server.domain.com -ScriptBlock {& "C:\Program Files\Microsoft Azure AD Sync\Bin\DirectorySyncClientCmd.exe"}
If you’re looking also to force a full password sync to Azure AD , visit this page – How to Use PowerShell to Trigger a Full Password Sync in Azure AD Sync
Just noticed now that the new build of Windows Azure Directory Synchronization Tool, is missing the DirSyncConfigShell.psc1 file.
Moreover, the Coexistence-Configuration PSSnapin is also gone. Trying to add the pssnapin would generate the error – The Windows PowerShell snap-in Coexistence-Configuration is not installed on this machine.
So if you’ve trying to use the known way to force a synchronization with DirSync, use these PowerShell commands to achieve what you were used to.
Import-Module DirSync
Start-OnlineCoexistenceSync
enjoy !
Yes, but how do you script this t be ran from a remote computer? This was awesome in the old way, but now it has completely screwed my scripts.
Can’t see any real difference… How did you approach this originally? Full remote powershell or did you installed it locally on the “script machine”?
Since the new module is there, the powershell console config file is not there. Also, when importing the DirSync module now appears to make a “remote” connection to something.
Before, I was using this command from remote server(s):
Invoke-Command -ComputerName -ScriptBlock {C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -psconsolefile “C:\Program Files\Microsoft Online Directory Sync\DirSyncConfigShell.psc1” -command “Start-OnlineCoexistenceSync”} -Credential $cred
This no longer works since the module change.
Try this:
Invoke-Command -ComputerName -ScriptBlock {C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command “Import-Module DirSync;Start-OnlineCoexistenceSync”} -Credential $cred
That should have the same effect..
I can’t import the dirsync module. Our original dirsync got messed up when I upgraded from 2012 to 2012r2. I removed it and installed a newer version. No dirsync module. No coexistence-configuration option. Nothing to make it automatic again.
If you installed the new ad connect / aadsync, look in the task scheduler. You will see the new EXE that will allow you to force sync.
I’ve updated the post with the new module name. Thanks for the feedback Barbara