Schedule Nightly Sync Errors to be Emailed
Overview
Every night, the Azure AD Service runs a scheduled task to synchronize changes in Microsoft 365 with Atria. These sometimes run into errors which could range from licensing changes to token renewal failures.
This document outlines how to create a scheduled task which exports the errors from the Atria Database, and emails it to somebody of your choosing to investigate and resolve the issues.
Requirements
A SMTP Server to relay the email message through (Any which is supported by the Send-MailMessage
cmdlet):
Instructions
- Download the attached Script below:
-
Open the script in PowerShell ISE on your Provisioning Server.
-
Update the highlighted parameters below and change these to apply to your business, populating the cmdlet as per the document here if more information is needed:

- Run the PowerShell Script. This should create a CSV export in the designated path and location:

- Open the CSV and confirm that this contains the relevant data and error(s):

-
Configure the PowerShell script to run at a designated schedule within Task Scheduler. Choose a time that is relevant to you and your team.
For the action, fill it out as per the table & Screenshot below:
Action | Start A Program |
---|---|
Program/Script | powershell |
Arguments | -file C:\CustomScripts\SyncLogs\Export-AzureADSyncErrors.ps1 |

- Make sure to check Run with highest privileges on the General page:

- Right click the task and select Run:

- Confirm that the email has been retrieved, and the new CSV has been created in the designated folder.
If you require any assistance or have any queries about this process, please contact us at support@getatria.com.