Suspend one drive while program runs

Dom 941 Reputation points
2023-12-10T14:10:46.25+00:00

I have a situation where I need to pause OneDrive before I start an application and then resume it after I close the application. I have been doing this manually, but need to automate it with some kind of script.

Google searches have yielded a couple of solutions but I'm not quite sure how to use them. I assume both of these would use a simple batch file.

#1:

[Suspend (shutdown) Onedrive:]

"%LOCALAPPDATA%\Microsoft\OneDrive\onedrive" /shutdown

[Resume Onedrive:]

start "OneDrive" /B "%LOCALAPPDATA%\Microsoft\OneDrive\onedrive" /background

In this scenario, where/how would I start the <application> and how would I tell the script to wait until I exit <application> before performing the "resume" portion?

#2:

This suggestion uses psuspend from sysinternals

pssuspend onedrive
<application>
pssuspend -r onedrive

I assume that psuspend would have to be placed in the folder where the OneDrive .exe resides? What would be the full command to launch <application>?

Would either of these accomplish what I'm looking for or is there a better approach?

Microsoft 365 and Office | OneDrive | For business | Windows
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Emi Zhang-MSFT 30,046 Reputation points Microsoft External Staff
    2023-12-11T01:55:59.48+00:00

    Hi,

    I suggest you post this issue to OneDrive development forum:

    https://techcommunity.microsoft.com/t5/onedrive/ct-p/OneDriveforBusiness

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.