OfficeDocs-SharePoint icon indicating copy to clipboard operation
OfficeDocs-SharePoint copied to clipboard

Central documentation of OneDrive.exe Command Line Options

Open PsychoData opened this issue 3 years ago • 11 comments

Hello,

I have tried to find a listing of OneDrive.exe Command Line Arguments, but I cannot find anything. I tried opening a Microsoft Support case (Case #:1026127313) but they told me that OneDrive and they told me "unfoortunately [sic] there are no Command-line switches for OneDrive", even though there most definitely are. A couple examples of Command-line parameters here.

It would be very helpful to update the Documentation for OneDrive to include some of these similar to this page - Command Line switches for Microsoft Office Products. For example:

Through experimentation and scouring dozens of docs pages, hundreds of computer's activity, and random blogs, I have found this list of Command Line switches/parameters for OneDrive.exe, and there may even be several more, but I have not found them.

/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

These functions could be extremely useful for IT Admins when they are scripting. For example, Onedrive.exe /Shutdown is extremely useful - it shuts down OneDrive gracefully, and onedrive.exe /background starts it back up again without throwing up the File Explorer window. OneDrive.exe /URL:odopen://$SharePointLibraryIDInfo will start a SharePoint site Syncing through to File-Explorer - mostly silently. Or, another example, this could be used so that instead of making the user click several layers/pages deep on multiple sites to sync their libraries, the IT Admins could script it to sync the respective directories/sites.

Currently, there is very little way to know what a given parameter like /silentConfig does though - Does it attempt to login with the settings from Group Policy? Does it Reset the current Profile's OneDrive and THEN try to login with the Registry Settings? Is it happy to just guess that you're logged in as [email protected] - so I'll see if I can SSO in with that?

We need actual documentation on these kinds of these Enterprise tools/features that are already in OneDrive and OneDrive.exe.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

PsychoData avatar Aug 13 '21 16:08 PsychoData

Thank you for submitting feedback and contributing to the docs. We are currently investigating this.

scanum avatar Aug 13 '21 21:08 scanum

@PsychoData I'm the new owner of this content. Thanks so much for bringing this to our attention. I absolutely agree that this information would be extremely helpful to Admins. I will get started on creating documentation accordingly. Your feedback is greatly appreciated!

adeejoseph avatar Jan 27 '22 23:01 adeejoseph

I've been looking all over for this, and I've seen many threads of people asking the same question. I'm glad the documentation is going to be produced. In the meantime, is there a switch for pause and resume sync without shutting down onedrive, or are the switches only for starting a new instance?

One unlisted switch I found in a support doc /reset appears not to do anything. I tested it with a known changed and online file, and the reset switch did not force a sync. This switch may only apply to onedrive for business.

I shotgunned my way into /restart, which causes Onedrive to resync the entire drive. (hard lesson to learn - I have half million objects pending in my sync)

Slaymeister avatar Feb 26 '22 18:02 Slaymeister

Hey @Slaymeister , you shoud first read the Limits and restrictions (here 300.000) files. So you will get into trouble Second: Reset is do, what it should, Also here an Article for you.

HansBrender avatar Feb 27 '22 18:02 HansBrender

Thank you for this! It was a huge help just the other day. We're just starting to roll out the client and someone thought it'd be a good idea to change our Azure tenant name without researching the potential impact. We use Azure AD SSO w/ Hybrid Joined workstations and domain group policies for configuration so our OneDrive client automatically signs in the Windows user. Some notes that may help others. Using this code running under logged on user context (with some other company specific code) I was able to update my pilot user's OneDrive folders to the new name. Silently re-logged in the user with the new path and Known Folder Move even re-applied.

Get-Process onedrive | Stop-Process -Force
Start-Sleep 5

$regPath = Join-Path -Path 'HKCU:\Software\Microsoft\OneDrive\Accounts' -ChildPath 'Business*' -Resolve
if($regPath){
    Remove-Item -Path "$regPath" -Recurse -Force
}

Set-ItemProperty -Path "HKCU:\Software\Microsoft\OneDrive" -Name 'ClientEverSignedIn' -Value 0 -Force | Out-Null
Set-ItemProperty -Path "HKCU:\Software\Microsoft\OneDrive" -Name 'SilentBusinessConfigCompleted' -Value 0 -Force | Out-Null
Start-Process 'C:\Program Files\Microsoft OneDrive\OneDrive.exe' -ArgumentList '/silentConfig /configure_business:<Your TenantID>'

mtaylor-dev avatar Mar 18 '22 16:03 mtaylor-dev

@PsychoData: Wow, I just missed /shutdown there because while it was in the text but not in the list formatted as code. So I just assumed it had been removed 😅 . If you feel like editing your post, it would be amazing to have it in the list explicitly, too 🤓

Thank you for compiling this!

(Denis Molodtsov over on StackOverflow additionally listed /takeover and /reset and maybe most interestingly /odopen:)

Merlin2001 avatar Mar 19 '22 06:03 Merlin2001

/odopen I knew about, it's how the odopen:// protocol works, which is how SharePoint syncs folders to your local explorer through OneDrive

How did I miss adding /shutdown?? That's the one that I found and started this whole thing with! I'll add that thanks

PsychoData avatar Mar 19 '22 15:03 PsychoData

I made a OneDrive module in PowerShell that does some things with a couple of the parameters, and edit the local config file to remove synced libraries https://www.powershellgallery.com/packages/Onedrive-client https://github.com/PsychoData/Onedrive-Client

PsychoData avatar Mar 19 '22 15:03 PsychoData

Is there any movement with this? Still no idea how many of these switches work, if there are new ones, if any are removed, et cetera

PsychoData avatar Jun 23 '22 15:06 PsychoData

Hello @PsychoData Kevin, we are still working on this

get-itips avatar Jun 24 '22 15:06 get-itips

It seems as though the /Background switch isn't behaving as expected. When users logon to our Azure Virtual Desktop infrastructure they're getting the explorer window popup. Running OneDrive Build 22.121.0605.0002.

robinmalik avatar Jul 08 '22 12:07 robinmalik

Has there been any movement on this?

jjwb96 avatar Oct 20 '22 16:10 jjwb96

Hi, any news please?

jirikm avatar Oct 28 '22 14:10 jirikm

Thank you, everyone, for sharing this information. The documentation team has OneDrive command-line options on their list of items to document. Unfortunately, there is not an ETA for when that documentation will be published.

tiburd avatar Oct 28 '22 15:10 tiburd

@tiburd Could you please keep this issue open as long as it's not done? I fear that otherwise it could get lost and never be improved :/

Merlin2001 avatar Oct 28 '22 16:10 Merlin2001

@tiburd Could you please keep this issue open as long as it's not done? I fear that otherwise it could get lost and never be improved :/

I understand that perspective/request. However, because our team has confirmed that the documentation team is tracking the issue in their workflow, our process is to close the issue.

tiburd avatar Oct 28 '22 16:10 tiburd