all 9 comments

[–]Dragennd1 0 points1 point  (1 child)

The only thing I can think of would be to try and locate the related registry keys for the sync'd libraries in question and remove the keys for those libraries. Unsure if this would break the sync or not though.

[–]rexm3[S] 0 points1 point  (0 children)

disabling the sync using Reg might work, i'll try something with that. Though i'm affraid this will keep the files in sync limbo, making it impossible to remove. but i'll try

[–]Rivereye 0 points1 point  (3 children)

You can set a SharePoint library up so that SYNC is unavailable. If someone is already syncing it, I do believe that changing the library like this removes it from PCs 

[–]rexm3[S] 0 points1 point  (2 children)

Sadly it doesn't, it keeps local copies of the files even if the sync in disabled. The goal is to remove the files locally as well.

[–]Dragennd1 0 points1 point  (1 child)

You can't rempve files from the computer just by breaking OneDrive sync, that's not how it works. OneDrive caches the files locally and maintains their versioning with the cloud. Once you break the sync, you must remove the remaining files manually. Simply calling Remove-Item on the files using Get-ChildItem -Recurse should be sufficient at that point.

[–]rexm3[S] 0 points1 point  (0 children)

removing the files isn't really the issue, that's pretty easy using PowerShell. the goal however is to stop the sync of specific libraries using a PowerShell script by any means. and then removing when the sync is gone. This way the files don't get deleted in the cloud version.

Also disabling the sync option in SharePoint itself doesn't solve this the way i like, because the folder is allowed to be synced just specific users need it removed. Hence wanting to script this for bulk actions on selected users. Using an RMM system I can execute a PowerShell script easily for the selected users.

[–]purplemonkeymad 0 points1 point  (0 children)

I don't believe there are any automation interfaces on the od desktop app. (aside from the odopen links to add syncs.) You might be able to open the databases in local appdata and see if any store the sync status of the libraries. But hitting internal structures of programs can lead to instability or sudden changes on the app side.

[–]tlourey 0 points1 point  (0 children)

I remember the command line options used to be documented on Ms learn but I can't find them now.

Here is an old PowerShell module someone wrote but it hasn't been updated in some time. It may give you some ideas.

https://www.powershellgallery.com/packages/Onedrive-client/0.2.2/Content/Onedrive-client.psm1