Feedback by UserVoice

How can we improve the OneDrive experience on Windows?

Pause Syncing with PowerShell

I would like a way to pause and unpause OneDrive syncing in PowerShell. This would be handy in PowerShell scripts that manipulate files. Sometimes the files get locked if OneDrive is currently syncing them. I would like to be able to script the pause, make my file changes, then unpause when my script is finished.

62 votes
Sign in
Sign in with: facebook google
Signed in as (Sign out)
You have left! (?) (thinking…)
Todd Klindt shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →


Sign in
Sign in with: facebook google
Signed in as (Sign out)
  • Anonymous commented  ·   ·  Flag as inappropriate

    Powershell and OneDrive do not get along well. In one script I open an Excel file, which is set to auto refresh some SQL data, then save the Excel file, close the workbook and quit the application with these last 3 lines:


    Works fine until the last line, which causes a sync failure in OneDrive, perhaps because it executes too quickly. If I leave the last line out, the file syncs fine.

  • John commented  ·   ·  Flag as inappropriate

    This would also help with scheduled backups using the Windows 7 Backup tool, which Files on Demand and OneDrive syncing have caused to fail in Windows 10 1803 and 1809. While I do not back up the OneDrive folders, the system image attempts to do so and fails.

  • James redmore commented  ·   ·  Flag as inappropriate

    Or any powershell endpoints for that matter. No good way to proactively monitor user workstations to ensure sync is running and healthy.

Feedback and Knowledge Base