Redeploy Backup for Known Folders ( Desktop / Documents / Picture)

Copper Contributor

We deploy with Intune the Setting "Silently move Windows known folders to OneDrive". This works perfect, but only one time. If the user change the setting after applies, the Policy will not applyed anymore.   Now I have developed the following command steps to re-run the process of moving. But It looks like a tweak ( without nowing of side effects). Is there any other way to do this. 

 

@echo off
cls
echo Resetting Folder Backup
for /F "tokens=3" %%A in ('reg query "HKCU\SOFTWARE\Microsoft\OneDrive" /v "OneDriveTrigger"') DO (set Onedriveexe=%%A)
 
echo %Onedriveexe%
 
reg delete HKCU\SOFTWARE\Microsoft\OneDrive\Accounts\Business1 /v KfmIsDoneSilentOptIn /f >nul 2>&1
reg delete HKCU\SOFTWARE\Microsoft\OneDrive\Accounts\Business1 /v KfmFoldersProtectedOnce /f >nul 2>&1
reg delete HKCU\SOFTWARE\Microsoft\OneDrive\Accounts\Business1 /v KfmSilentAttemptedFolders /f >nul 2>&1
reg delete HKCU\SOFTWARE\Microsoft\OneDrive\Accounts\Business1 /v LastKnownCloudFilesEnabled /f >nul 2>&1
reg delete HKCU\SOFTWARE\Microsoft\OneDrive\Accounts\Business1 /v LastKnownFolderBackupLaunchSource /f >nul 2>&1
reg delete HKCU\SOFTWARE\Microsoft\OneDrive\Accounts\Business1 /v LastKnownFolderBackupTime /f >nul 2>&1
 
start "Onedrive - RESET " /min "%Onedriveexe%" /shutdown
powershell.exe -Command "Start-Sleep -MilliSeconds ( 1000 * 5 )
start "Onedrive - Configure " /min "%Onedriveexe%" /background
powershell.exe -Command "Start-Sleep -MilliSeconds ( 1000 * 5 )

  

Related to this thread I found also this Discussion

Reporting on Known Folder Move status? - Microsoft Tech Community 

 

and now I change parameters to clear onedrive from /reset -> /shutdown and /configure -> /background so Thx

 

 
 
 
0 Replies