Category Archives: Automation

Monitoring and fixing Onedrive client sync health

Onedrive for Business is most user’s gateway to cloud storage in Microsoft 365.

But sync errors are still a daily issue, and sometimes get worse when e.g. running virtualized (max 100k items), hitting large folders, long paths, or running locally with lots of syncs (max 1m items on preview).

Onedrive does not have a PS module or online console to monitor which users are stuck. Some approaches have been posted by the community, e.g:

  • my and Rudy’s solution from ~2020 monitoring the sync state log file that can lag for days.
  • Custom libraries that have dependencies and don’t remediate
  • Reading the registry by Kelvin (no remediation, more a counter when you’re near a threshold)
  • Microsoft’s sync dashboard as described by Florian (no remediation, lagged and very basic detection)

As I was seeing lots of stuck clients on AVD when users were adding links to Onedrive, I wanted to find a faster and more reliable method of detecting sync issues.

And why stop there? Remediation is around the corner… 🙂

So with Claude I went hunting and found a hook in the Windows 11 storage provider status API / cldapi.dll

This show the status and ability to hydrate files on demand, and progress.

Moving to remediation, it’s a fairly simple matter to monitor sync status and progress, and TEST a single small file hydration. If that is failing, Onedrive is stuck and needs a restart. For us, this has fixed a lot of stuck onedrive clients underneath RemoteApps in AVD 🙂

Links:

View and Remediate (Intune): https://github.com/jflieben/assortedFunctionsV2/blob/main/O4B/remediate-OneDriveHydration.ps1

View and Remediate (GPO/logon): https://github.com/jflieben/assortedFunctionsV2/blob/main/O4B/repair-OneDrive.ps1

Experiment

Last week I had Claude code a game, based on games my friend and I liked in the past.

Had to go back and forth several times, Claude ended up building a diablo rpg + tower defense style game with a story. Last weekend we spent a whole evening and it was fun!

I was blown away by how little bugs/bugfixing I had to do, and that it generated reasonably believable voices and storylines, enemy AI and even bot AI for those without a gaming buddy.

Don’t think I want to go through a steam publishing etc…so here’s the game for whoever wants to give it a spin!

https://jsolve.itch.io/gloomdrill

Replacing MemberOf in Entra after it is deprecated

Microsoft is phasing out the memberOf option in Entra Dynamic Groups, in November.

https://learn.microsoft.com/en-us/entra/identity/users/groups-dynamic-rule-member-of

This was in preview, but thousands upon thousands of tenants are of course using this in production. Microsoft thus may delay, but in either case, this called for a replacement. A good plan and Claude to the rescue!

A simple azure runbook you can plug and play into your environment, readme and code are here:

https://github.com/jflieben/assortedFunctionsV2/tree/main/EntraMemberOfSync

It basically completely replaces this functionality in Entra 🙂

Example of output of the runbook:

DriftMaester 1.3.0

With Maester 2.2, we now finally have Sharepoint support and tests! And of course much more, but that’s what stood out most to me. (legacy active directory just makes me feel dirty).

So, DriftMaester also needs to handle these new permissions and has the new pnp module dependency! Time to update 🙂

DriftMaester auto updates, but it doesn’t have permissions to increase its own permissions. So, for whoever wants to leverage the new tests, run this quick oneliner in Azure Shell!

iex ((Invoke-WebRequest -UseBasicParsing 'https://raw.githubusercontent.com/jflieben/DriftMaester/main/Update-DriftMaesterPermissions.ps1').Content)

You can also run the full GUI again as it is a fully idempotent install (overwrite without delete):

iex ((Invoke-WebRequest -UseBasicParsing 'https://raw.githubusercontent.com/jflieben/DriftMaester/main/Install-DriftMaester.ps1').Content)

The full changelog of 1.2.0 to 1.3.0 is:

  • SharePoint Online support: the installer grants the managed identity the SharePoint Sites.FullControl.All application role, and the invoke runbook connects PnP.PowerShell to the tenant admin endpoint with that managed identity so the Maester SharePoint Online tests run unattended.
  • Reports now lead with the number of passed tests instead of the score percentage as this is more valueable when new tests are added
  • Fixed the ORCA tests failing with “Cannot find type [PolicyInfo]”. Maester is now imported at script scope in the invoke runbook, because its manifest loads the ORCA class definitions through ScriptsToProcess, which only defines them in the scope that called Import-Module.
  • The installer now reuses the Azure sign-in for Microsoft Graph by passing an Az-issued Graph token to Connect-MgGraph, so the admin signs in once instead of twice.
  • Centralized permissions and added a permissions reconciliation script (Update-DriftMaesterPermissions.ps1) that automatically adds new permissions and can be executed lightweight in Azure Shell