Jump to content

Removing shared Team Libraries from OneDrive sync via GPO


Recommended Posts

Posted

Until recently, we've been syncing our SharePoint shared areas in the OneDrive client. These have been deployed using the GPO setting Configure team site libraries to sync automatically.

 

These have been causing us problems, mainly due to sync conflicts causing people to be missing their file changes, so we want to remove these now.

 

I've removed the site libraries from our group policies, but I've not been able to find any way to remove these libraries from individual users OneDrive clients. If I clear out the registry settings in HKCU, they just come back after closing and reopening OneDrive client. OneDrive.exe /reset resets quite a bit of stuff, but restarts with all the same team libraries still sync'd. Deleting %APPDATA%\Local\Microsoft\OneDrive\settings and restarting OneDrive client sort of works, but chucks a lot of errors and the member of staff has to sign in again manually.

 

And then there's the issue of the files left in the user profile, that were previously sync'd. These need to be removed to avoid confusion, but how to do that, without accidentally deleting the files in SharePoint....

 

Has anyone successfully achieved this via script or policy, or do I need to wait until the next time I rebuild PCs and wipe the user profiles?

Posted (edited)

First of all will it un-link the document Library sync if you do it manually by going into OneDrive sync settings as user? If not and OneDrive crashes I think you might be suffering from an issue in the recent Windows updates. Basically if you remove a SharePoint document library that is synced OneDrive client will crash and then it will reconnect again. No way to stop it Syncing!

 

KB5020953 cumulative update should address, If indeed it doesn’t work manually and that is the root cause of your issue.

Edited by MicrodigitUK
  • Thanks 1
Posted
First of all will it un-link the document Library sync if you do it manually by going into OneDrive sync settings as user? If not and OneDrive crashes I think you might be suffering from an issue in the recent Windows updates. Basically if you remove a SharePoint document library that is synced OneDrive client will crash and then it will reconnect again. No way to stop it Syncing!

 

KB5020953 cumulative update should address, If indeed it doesn’t work manually and that is the root cause of your issue.

 

 

I can un-link the library OK in the client, if I do it manually. It's being able to do it globally via GPO that I'm stuck on.

  • Thanks 1
Posted

Looks like you also need to remove entries from the ini file.

 

Stop sync client

Remove relevant registry keys

Remove entries from ini file

Delete folder if needed

Start sync client

 

Looks like someone’s produced a PowerShell script that does it for you, Look on this Microsoft post.

 

https://social.msdn.microsoft.com/Forums/office/en-US/072e3577-d0ff-4950-9e0b-40b037853881/starting-and-stopping-sharepoint-library-sync-with-onedrive?forum=sharepointdevelopmentprevious

  • Thanks 1
Posted

Thanks for that, useful reading.

 

For our purposes, I've found that just killing off the OneDrive HKCU key, then logging off and back on, is enough to remove the associations. It's a blunt method, but as far as I can tell it forces another setup from scratch - which is fine in our environment, as I've got that process running silently.

 

The sticking point seems to be getting rid of the previously cached files, as it's reading these as several hundred GB, even though the reality is it's just a few KB of dehydrated OneDrive symbolic files. I guess I'll try and put a login script to run in the background to clear this up.

  • 1 year later...
Posted
Thanks for that, useful reading.

 

For our purposes, I've found that just killing off the OneDrive HKCU key, then logging off and back on, is enough to remove the associations. It's a blunt method, but as far as I can tell it forces another setup from scratch - which is fine in our environment, as I've got that process running silently.

 

The sticking point seems to be getting rid of the previously cached files, as it's reading these as several hundred GB, even though the reality is it's just a few KB of dehydrated OneDrive symbolic files. I guess I'll try and put a login script to run in the background to clear this up.

 

How did you kill off that OneDrive HKCU key??

Posted
How did you kill off that OneDrive HKCU key??

 

 

This was a while ago now, but I think I just used the below in a logon script.

reg delete HKCU\SOFTWARE\Microsoft\OneDrive /f

 

You could also just do a registry preference to delete that key, and tick one time only.

 

As per my comment above though, the next problem I faced was deleting the versions of files which had already been cached. In the end I wrote something quite convoluted that renamed and hide the files I didn't want to see.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...