In this blog post, I will show you how to start Azure AD connect (also knows as ADsync) Active Directory sync to Office 365 from a remote machine using PowerShell.
In my case, I needed to start AD sync from a remote machine as part of a migration script.
Code
The following code is using the invoke-command script to connect to the Azure AD Connect server and start a delta script.
The code also waits for confirmation before exiting.
$ErrorActionPreference = "Inquire" Invoke-Command -ComputerName AZUREADSERVER -ScriptBlock {Start-ADSyncSyncCycle -PolicyType delta} Read-Host -Prompt "Press Enter to exit"