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

Manufacturing and IoT Securing Connected Devices

Manufacturing and IoT: Securing Connected Devices

You're the operations manager of a cutting-edge manufacturing facility, overseeing a production floor buzzing with activity. Your team relies on...
Small Business Cyber Security Toolkit

Small Business Cyber Security Toolkit: The Tools You Need to Stay Protected

With great power comes great responsibility, especially when it comes to running a business and protecting your digital assets. As...
Business-Continuity-Plan-Template-for-Municipalities-Intrust-IT

Business Continuity Plan Template for Municipalities

Municipalities are facing increasing cyber attacks.  With cybercrime rates soaring and municipalities ranking as prime targets, the need for robust...
Cybersecurity Strategies for Municipalities 8 Expert Tips - Intrust IT

Cybersecurity Strategies for Municipalities: 8 Expert Tips

Municipalities tasked with safeguarding sensitive data and critical infrastructure are increasingly the targets of cyberattacks. Municipalities often handle a vast...
Business Continuity Guide for City Managers - Intrust IT

Business Continuity Guide for City Officials

The resilience of a city's operations hinges on its ability to effectively weather unforeseen challenges. From natural disasters to cyber...
Integrating AI for Enhanced Security - Intrust IT

Integrating AI for Enhanced Security

Organizations face an unprecedented array of cybersecurity threats, and now, cybercriminals are actively leveraging artificial intelligence (AI) to help create...