Centrally Monitor Microsoft OneDrive Sync Status

How to Centrally Monitor Microsoft OneDrive Sync Status

Unfortunately, Microsoft hasn’t provided a good way to monitor OneDrive sync status centrally, which is why we’ve kept it at arm’s length for customer solutions.

Without central reporting through Office 365, we have to rely on endpoint monitoring of the sync client itself. The key to accomplishing this is a custom OneDriveLib.dll which interfaces with the OneDrive API and reports on sync status of the locally installed OneDrive client.

For OneDriveLib to work, you must query each OneDrive path within the user profile. It is an open-source project, which can be downloaded here. There is also a post about this on the Microsoft Developer Network.

Using OneDriveLib

So now that we’ve established what OneDriveLib is and what it does, here’s how we use it.

OneDriveLib needs to be on the system being monitored, and can be used within PowerShell by importing it like a module (Install-Module OneDriveLib.dll). From there, running Get-ODstatus -ByPath OneDrivePath will report the sync status of the OneDrive library. The statuses that may be reported are:

  • Error
  • Shared
  • SharedSync
  • UpToDate
  • Syncing
  • ReadOnly
  • NotInstalled

To accomplish this, we push OneDriveLib and a PowerShell script to pull the data that we’re looking for. This script reports the status of the OneDrive for Business (excluding Personal) client, writes a status.log to a temp directory. This status.log then gets pulled into a custom field in Kaseya. If that custom field gets set to Error, then it creates a ticket for our support team to investigate the issue. Any file that fails to sync will put the client into an Error state.

Now that we have a central way to monitor OneDrive sync status, we are more comfortable using Microsoft OneDrive for Business as a solution for our clients.

Here’s the PowerShell script we use:

Import-Module “OneDriveLib.dll”

$results = @()

$tresults = New-Object PSObject

$textfile = ‘status.log’

$ucontents = Get-ChildItem $env:USERPROFILE | Where-Object {(($_ -like “*OneDrive*”) -or ($_ -like “*SharePoint*”)) -and (-not ($_ -contains “Unsynced”))}

Intrust IT Intrustimonials

Intrust Man

Intrust Man may be small, but he is mighty smart. You can trust this clever cartoon hero to provide news you can use.

Share this Blog

Enterprise Password Management Promo Wide

Is Your Name or Birthday a Part of Your Password?

If so, you’re a part of the 59 percent of people who don’t follow proper password hygiene. More than 70 percent of passwords are used for more than one system, meaning if cybercriminals crack one, they can access a lot more accounts.

Our free Enterprise Password Management Guide will give you the best password hygiene practices to help you secure your computer and your business.

Download the Guide

Explore the Latest Trends in IT

Cybersecurity for Small Businesses Threat Management Strategies - Intrust IT

Cybersecurity for Small Businesses: Threat Management Strategies

The threat of cybercrime looms larger than ever before. With each passing year, we witness a staggering rise in cyberattacks,...
The Crucial Role of Data Backup in Business Continuity and Disaster Recovery - Intrust IT

The Crucial Role of Data Backup in Business Continuity and Disaster Recovery

Data is the lifeblood of any modern business operation. All organizations rely heavily on digital information, from customer and financial...
What is Two Factor Authentication, and Why Does it Matter - Intrust IT

What Is Two Factor Authentication, and Why Does It Matter?

You’ve likely seen security updates on your phone or computer asking you to set up 2FA or MFA to increase...
Should Information Technology Companies Allow Workers 9 Days AFK - Intrust IT

Should Information Technology Companies Allow Workers 9 Days AFK?

At Intrust IT, we know how powerful stepping away from work can be for our employees’ well-being. We became employee-owned...
The Advantages of Opting for a Managed SOC - Intrust IT

Benefits of Continuous Cybersecurity Monitoring with a Managed Security Operations Center (SOC)

Introduction: The Importance of Robust Cybersecurity in Today's Digital Age As a leading managed service provider, we’ve seen cyber threats...
Local Government Security Breaches Are City Managers Prepared - Intrust IT

Local Government Security Breaches: Are City Officials Prepared?

Virtually every day there’s a new headline about novel cyber threats, government security breaches and municipal government cyber attacks that...