Remote Entra Connect Sync script for management servers

Sometimes you just want to trigger an Entra Connect sync quickly, without opening an RDP session to the Entra Connect server itself. For that reason I made a small PowerShell script that runs the sync remotely from a management server. It keeps the action simple: connect to the Entra Connect server, start a delta sync, show the result, and catch errors if something goes wrong.

You can find the script here:

Download script from GitHub

What the script does

The script does five simple steps:

  1. Connects remotely to the Entra Connect server using the existing authentication context
  2. Starts a delta sync on the remote server
  3. Prints the result on screen
  4. Catches and shows errors if the action fails
  5. Waits and shows possible errors for 15 seconds and closes the PowerShell window

Script settings at a glance

There is only one setting you normally need to change:

VariableExample valuePurpose
$adconnectserverJV-DC-SRV01.justinverstijnen.nlThe FQDN of your Entra Connect server

Open the script and change the $adconnectserver variable to the FQDN of your own Entra Connect server.

For example:

PowerShell
$adconnectserver = "YourEntraConnectServer.yourdomain.local"

After that you can run the script from the management server which is joined to the same domain as your Entra Connect server.


Let’s test the script

Open PowerShell on your management server and run the script. You possibly need to bypass the PowerShell execution policy once:

PowerShell
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process -Force

Then you can run the script without any errors for the duration of the PowerShell window:

Bash
.\JV-RemoteADSyncScript.ps1

This will look like this:

Screenshot 2026-06-29 163438.jpg

If the remote connection works and the sync starts correctly, the script prints the returned result and checks whether the result equals Success followed by a green line that the synchronization has been successfully executed. Otherwise, the exact error will be printed as error into the same window. This gives you the chance to immediately fix that particular issue.


Summary

This remote Entra Connect sync script is a simple way to trigger a delta sync from a management server. You only need to set the FQDN of your Entra Connect server, make sure remoting works, and run the script. It will start the sync, print the result, and show any error if something goes wrong.

If you want a quick and practical way to start a manual Entra Connect sync without logging on to the Entra Connect server itself, this script does exactly that.

Thank you for reading this post and I hope it was helpful!

 

End of the page 🎉

You have reached the end of the page. You can navigate through other blog posts as well, share this post on X, LinkedIn and Reddit or return to the blog posts collection page. Thank you for visiting this post.

Page last updated September 27, 2026: Scheduled posts (4c0b873)