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

Fundamentals of Information Technology Management - Intrust

IT 101: What Is Information Technology Management?

When was the last time you stopped to think about how your business relies on technology? Information technology management is...
Avoid Pig-Butchering - Intrust IT

Pig-Butchering Scams: What They Are and How to Stay Safe

At Intrust IT, we understand that it may feel like the specter of cybersecurity is always breathing down your neck....
3 Reasons to Replace Aging Equipment - Intrust IT

Three Compelling Reasons Your Company Should Replace Its Aging Computers Before Year-End

As the end of the year approaches, businesses everywhere are evaluating their budgets and looking for strategic opportunities to invest...
What are managed services - Intrust IT

What Are Managed Services? And What Are the Benefits?

Running a business in today’s tech-driven world means you need reliable IT infrastructure. But let’s be honest, managing IT in-house...
Windows 10 End of Life How This Could Impact Your Business - Intrust IT

Windows 10 End of Life: How It Could Impact Your Business

As Microsoft officially plans to end support for Windows 10 on October 14, 2025, businesses need to begin thinking ahead....
AI implementation Roadmap Intrust IT

Master AI Integration With Our AI Implementation Roadmap Guide

AI is one of the greatest technological breakthroughs of the last few years. It has become our handy assistant, data...