There can be situations where you want that Ondrive runs in the background, for example for some process or automation to complete.
On researching internet , I have seen people are having issues to implement or are able to do it only when account is login to the system and as soon as it is logged out, it stops working.
We have a requirement to do the same, earlier We were doing it by logging into the system with that account & kept that logged in.
Due to Monthly patching reboots or some one from the team was inadvertently logging that account out.
To fix this problem below has been done:
Create a batch file : I have added task kill so that onedrive process is started again whenever scheduled task is repeated as I have seen some times after few days it stops working so this step makes it more stable.
Taskkill /IM OneDrive.exe /F
Now schedule it with the user account for whom you want to sync the onedrive in the background.
Schedule it to Run daily
In the actions tab add the batch file location and also update the optional section with Start In folder as:
Now under settings Choose Stop the existing instance.(otherwise task will never get started second time as it will be detected as running)
Save these settings by clicking ok , add the password of the account when prompted.
Onedrive is now ready to run in the background.
Note: if you login from this account to this machine than onedrive will stop working, make sure after logging out you stop the running Scheduled task and run it again.
Thanks for reading.