Forum Discussion
OneDrive Sync/Stop Sync - delete local files
Looking for a solution
User syncs SPOL library
User stops Sync
Local file/folder structure remains - Looking for ideas on script that can run and delete those local files/folder once status goes from Sync to Stop Sync -
The endpoints are intune Azure Joined - so we can push out a script -
But first need to understand how OneDrive StopSync command communicates with the OS so I can use that as a trigger.
Thanks,
SJ
1 Reply
- markrwdn2245Copper Contributor
I have the same question ScottonTap does - how can we tell clients that our staff no longer have access to files if we cannot delete them from their machines after removing Sharepoint access?
The 'Sync' option should automatically be turned off after access is withdrawn, meaning we should then be able to run a powershell script to delete the local copy of the folder. Currently even if I click 'stop sync' on the folder I'm still met with Powershell telling me I can't delete the folder because 'Access to the cloud file is denied' if I run the below:
Remove-Item -Recurse -Force "local path name"