The new Onedrive for Business client when installed on Windows 10 has a number of options we can use to streamline the user portion of the configuration. I’ve taken information from several sources and written a single “Do It All – Onedrive For Business configuration script” for the Windows 10 Modern Management (Intune MDM Azure AD Join) scenario.

The script can be deployed through Intune and will do the following:

  • check latest O4B version, install if needed
  • detect O4B configuration, start auto config
  • completely silent configuration with SSO
  • optionally, enable Files On Demand
  • optionally, redirect folders to Onedrive
  • optionally, copy old content

Other stuff you’ll like to know:

  • The script logs to %APPDATA%\Temp on the local device for the user details
  • The script logs to c:\windows\temp for the SYSTEM install portion
  • User needs to have an Intune license
  • If MFA is enabled the ‘silent’ part won’t apply, but redirection is still applied after the user finishes Onedrive configuration
  • User does not need to be local admin
  • Script runs at each logon (scheduled task) but is invisible due to a VBS wrapper

Credits / Sources used:


  1. Download script source and save locally: GitLab link
  2. Go to Intune and add the Powershell script:
  3. Now assign the added script to a group containing your users4. Click OK, you’re all set!

Note for Office 2016 MDM users: the Intune deployment of Office may conflict if it runs at the same time, this will delay the installation by a few minutes but will not cause issues.

Leave a Reply

13 Comments on "O4BClientAutoConfig"

newest oldest most voted
Notify of

The Join-Folder in the script should be Join-Path


Hi Jos,
i am trying to redirect download folder in O4b. i know its not a part of Windows library but how can i add this folder in o4b could you please help me out ?


Awesome script Jos! I’m testing this with some client machines before rolling out across our customer fleet.
Little thing I’ve found is OneDrive client reinstalling on every login. In the log I get this “TerminatingError(Get-ItemProperty): “The running command stopped because the preference variable “ErrorActionPreference” or common parameter is set to Stop: Property Version does not exist at path HKEY_CURRENT_USER\Software\Microsoft\OneDrive.”
But in the reg, the key is there and the value is 17.005.0107.0008 yet in the script it says “Microsoft’s XML shows the latest Onedrive version is 17.005.0107.0004 and can be downloaded from https://oneclient.sfx.ms/Win/Insiders/17.005.0107.0004/OneDriveSetup.exe


Hey Jos, great work again!
Just struggeling with redirecting the user download Folder to od4b.
I guess its missing in “Get-KnownFolderPath”. Could you help me out with this one?


Hi Jos, New-ScheduledTaskPrincipal -GroupId “BUILTIN\Users” gives an error : No mapping between account names and security IDs was done. Is this because my OS language? Changing it to New-ScheduledTaskPrincipal -GroupId “Gebruikers” works.

Office 365, Azure, Enterprise Mobility and DevOps