Force Onedrive sync
July 4, 2024
After login it can take several minutes before Onedrive syncs files to the local machine. Checking the status tray icon says "up to date" and lists some files but looking online in the same folder shows newer dates. How to trigger a sync on demand?
Not quite a pause / resume script, but you can simply exit OneDrive by creating a shortcut or running:
"C:\Program Files\Microsoft OneDrive\OneDrive.exe" /shutdown
Which will effectively "pause" synchronising.
Then you can silently restart it with another shortcut:
"C:\Program Files\Microsoft OneDrive\OneDrive.exe" /background
Where it will start merging changes again.
I can't remember where I found these switches originally, but there is a list of them here.
From <https://superuser.com/questions/1742608/batch-script-to-pause-and-resume-one-drive-sync>
not yet tested.
the 'here' link is broken. --> wayback link https://web.archive.org/web/20220702175528/https://github.com/MicrosoftDocs/OfficeDocs-SharePoint/issues/2905
β¦
Unofficial OneDrive command line arguments
/allUsers
/Background
/client=
/configure_business
/configure_business:$tenantID
/firstSetup
/onPrem
/perMachineUpdate
/update
/RemoteBindToObjectWW
/remotedebug
/remoteport
/rz possibly
/silentConfig
/takeover
/url
/url:odopen://
/wait
/OneDrivePid:
/Shutdown
/Reset
If the arg doesn't work as expected try all lower case (ref).
These switches were reverse engineered from various conversations around the web. None are guaranteed, something that works today might stop working tomorrow.
From <https://github.com/maphew/Onedrive-Client/blob/ondrive-cli-args/docs/Onedrive_CLI_arguments.md>