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

World Backup Day - Intrust IT

World Backup Day: Protect Your Data Before It’s Too Late

Imagine waking up to find every file, photo, and document on your devices gone. There is no warning, no chance...
What's Included in Managed IT Services - Intrust IT

Your Guide: What’s Included in Managed IT Services?

Technology should empower your business, not hold it back. Yet, for many companies, managing IT systems feels like playing whack-a-mole...
Donald Trump Memecoin - Intrust IT

Donald Trump Memecoin: What you Need to Know From an IT Expert

Lately, I've been receiving many questions from people unfamiliar with cryptocurrency about Donald Trump's new memecoin, the Trump memecoin, $TRUMP....
MFA ByPass - Intrust IT

Understanding MFA Bypass Attacks

In the world of best cybersecurity practices, multi-factor authentication (MFA) is a crucial defense against cyber threats. However, as security measures evolve,...
How to Hire an IT Company - Intrust IT

How to Hire an IT Company: Top 10 Questions to Ask

Hiring a managed service provider (MSP) can feel like a daunting task. Your organization’s success and security depend on finding...
Vishing Attacks Surge - Intrust IT

Vishing Attacks Surge: What It Could Mean for Your Organization

Cybersecurity threats continue to evolve at a lightning pace, and one growing menace should be on every business leader’s radar:...