With the introduction of Onedrive Sync Heath in the Office portal, we have a much improved view on sync errors of our users. Errors they may not even be aware of.
However, there is no remediation option, so I am sharing a framework based on previous work in Proactive Remediations that can report on the Onedrive client status and trigger a remediation, which looks like this:
Currently, the only remediation method is to restart the Onedrive client, but the script is easily adjusted for additional remediation actions or conditions the community deems useful.
When Paused or Disabled are detected, there is no remediation as this is not technically an error but something the user manually set. This can be adjusted to your local needs easily.
You can find the Proactive Remediation script on Gitlab:
To use it, follow the steps in my previous article using proactive remediations (LAPS).
the only difference with LAPS config is that the script should run in user context:
The detection and remediation scripts are the same, the script is smart enough to detect if it is running in detection or remediation mode.
Credits go to Rudy Ooms for writing about the different status codes of the Onedrive client 🙂