This post will be short and sweet. I will show you how to create a simple script that will run the Azure AD Connect Sync service. The AAD Connect Sync service runs every 30 minutes but if you don’t want to wait for that, try saving the PowerShell script below.
Write-Host -fore Green “Starting Azure AD Sync”
Invoke-Command -ComputerName AADConnect-ServerName -ScriptBlock { Start-ADSyncSyncCycle }
Read-Host “Azure AD Sync has started. [Enter] to view results.”
Read-Host “[Enter] to exit.”
If you don’t want any interaction and simply want to run a Delta sync, you can use:
Invoke-Command -ComputerName AADConnect-ServerName -ScriptBlock { Start-ADSyncSyncCycle -PolicyType Delta }