What It Does
This script is read-only. Run it on the Microsoft Entra Connect server, as SYSTEM from your RMM. On a computer without the ADSync PowerShell module it ends SKIPPED. It shows one row for each check.
First the ADSync service: it must exist, be running and not be set to Disabled or Manual. Then the scheduler: sync cycles must be enabled and the scheduler must not be suspended (Connect suspends it during an upgrade). The server mode must match ExpectedMode, which is Active by default, or Staging for the standby server, or Any. A staging server imports and synchronizes but does not export to Entra ID.
Then the sync run history. The newest run of every connector must have the result success, and the newest run of all must have started within MaxAgeHours (default 3, which covers the 30 minute cycle). An empty run history alerts; Connect keeps seven days of it by default.
Last the installed version, read from the installed program entry or, failing that, the sync engine file, against MinimumVersion. The default is 2.6.84.0, the version Microsoft's version history says is required, with application based authentication, by 7 April 2027. An empty MinimumVersion skips the check, and a version that cannot be found is shown as not found and does not alert.
It alerts on any failure and the answer lists every problem. To start a cycle, use invoke-entra-delta-sync. A second run simply checks again.
Before You Run It
- Run it on the Entra Connect server, as SYSTEM from your RMM, with administrator rights.
- Set ExpectedMode to Staging on the standby server, so it does not alert for being in staging mode.
- Set MinimumVersion to empty if you do not want the version check.
- Keep MaxAgeHours above your sync interval.
- Schedule it in your RMM and alert on exit 1.
- Pair it with test-entra-connect-sync, which reads the same sync from the cloud.
Type and Risk
- Type: Monitor. It checks one condition. It exits 1 when it finds the problem, so your RMM can alert on it, 0 when all is well, and 2 when it could not run.
- Risk: Low. It reads and changes nothing.
- Restart: It never restarts the machine.
- Typical run: Under 30 seconds.
- Example answer: "Entra Connect 2.6.92.0, active; service running; 3 connectors, newest run 14 min ago, all success"
- Tested before listing on a Windows Server 2025 domain controller (VM) with Windows PowerShell 5.1, run as SYSTEM, against its own test cases.
Inputs
Pass an input as an argument (-Name value), as an environment variable with the same name, which is how most RMMs pass script variables, or change its default in the param() block at the top of the script. An argument wins over an environment variable, which wins over the default.
- ExpectedMode: Active (default: this is the server that exports to Entra ID), Staging (this is the standby server) or Any. A mismatch is an ALERT.
- MaxAgeHours: Alert when the newest sync run started more than this many hours ago. Whole number, 1 to 720. Default 3.
- MinimumVersion: Alert when the installed Entra Connect version is lower than this, such as 2.6.84.0. Default 2.6.84.0. Empty skips the version check.
Every script also takes DryRun, OutputFormat (Text, Answer, Json or Csv), ExportPath and ResultField, which writes the answer to an RMM custom field.
License
Provided "as is" under the MIT License, without warranty of any kind. Test before production use. MSP Outpost and User First Digital Inc. accept no liability for any damage or loss.