Share via

Deploying OneDrive for Business – An Example


Deploying OneDrive for Business is a task that can easily be handled with ConfigMgr. Configuring the deployment is easy but the process is not typical. My colleague, Paulo Jorge Morais Dias, has written a blog on how to do this – available here. The process he describes is similar but different from what I have done so I’m also writing up the process. The differences between the two examples illustrate that there are at least two and, in reality, several ways to handle the deployment.

In this example OneDrive for Business is deployed using the application model and makes use of three separate applications.

Application 1 – OneDrive for Business – Registry Import

Part of installing OneDrive for Business requires configuring registry keys as needed. These registry keys could be added in several ways – GPO, a script deployed through ConfigMgr or several other ways. In the example the application simply deploys an exported set of registry keys using reg.exe as follows.


Command Line

Reg.exe import onedriveregistry.reg

The example OneDriveRegistry.reg file



The registry import application MUST be set to run under user credentials. The specific registry keys being added exist under HKEY_CURRENT_USER. Installing under system credentials would cause the registry keys to be added in the incorrect location.

Application 2 – OneDrive for Business – Main Executable

The OneDrive for Business main executable is OneDriveSetup.exe and is deployed silently.


Command Line

“OneDriveSetup.exe” /silent


The OneDriveSetup.exe MUST be installed under system credentials. One customer I have worked with had a challenge with the application working correctly until they enabled the option to allow users to interact with the application. In the example, settings allow the OneDriveSetup application to run ‘Whether or not a user is logged on’. In such a configuration there is no option to allow user interaction but in the customer’s case they had chosen the option ‘Only when a user is logged on’. In such a configuration the customers experience was that the OneDriveSetup portion never completed or appeared in Programs and Features until user interaction was allows. I have not tested such a configuration since it shouldn’t be common but including in the event others see the issue.

Application 3 – OneDrive for Business – User Install

The user portion of the install deploys OneDrive.exe. The OneDrive.exe is actually deployed as a part of installing OneDriveSetup.exe. The key to deploying OneDrive.exe is to ensure it is moved to the user’s profile and launched under users credentials. There are several ways to do this. In the example the command line runs a script which will first copy the OneDrive.exe source files from the ccmcache location to the user’s profile and then launches OneDrive.exe to facilitate the install.


Command Line

PowerShell.exe -executionpolicy bypass -File "DetectorsetOneDriveinstall.ps1"

The PowerShell script copies the source files from ccmcache to the user’s profile directory and then launches the install.

##Declare and set variables.
##Get user profile environment variable
$UserProfile = Get-Item Env:UserProfile
##Get the value item from the environment variable
$UserProfileValue = $UserProfile.value
##Define the path to the location where onedrive should be installed
$OneDriveLocation = "\appdata\local\microsoft\onedrive"
##Combine users profile with the location where the onedrive files are to be copied
$OneDriveTestPath = $UserProfileValue + $OneDriveLocation
##Check to see if the path already exists
$OneDrivePresent = Test-Path $OneDriveTestPath

##If the folder doesn’t exists, create it.
If ($OneDrivePresent -eq $False)
       New-Item - ItemType Directory -Path $OneDriveTestPath

##The script current hard codes the ccmcache location. Adjustments to the script
##need to be made to convert the static ccmcache location to dynamic.
Copy-Item "c:\windows\ccmcache\6\*" -Destination "$OneDriveTestPath" -Recurse

##Launch the OneDrive.exe executable with appropriate command line options
Start-Process -FilePath $OneDriveTestPath\OneDrive.exe -WorkingDirectory $OneDriveTestPath -ArgumentList "/configure_business" -NoNewWindow -Wait


The deployment MUST run under the user’s context.


That’s all there is to it! There are some tweaks that could be made to accommodate environment specific details. In the example no configuration was done to accommodate uninstalls so that is also an area for additional configuration improvement but the basic configuration works perfectly!

Note: When deploying these applications, it is possible to deploy each one individually, link Application 1 and 2 in a dependency relationship or link all three together and deploy as a unit.