O4BClientAutoConfig

ARTICLE SUPERCEDED BY Ultimate folder redirection for Onedrive, Teams and Sharepoint

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 and Onedrive for Business 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:

Instructions:

  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.

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

38 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Tim
Tim
6 years ago

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

trackback

[…] O4BClientAutoConfig | Liebensraum  […]

Beat
Beat
4 years ago

Hi Jos
Microsoft now offers Known Folder Move. Can I also move the folders to subfolders at KFM?
Your script contains the icons Desktop, Images and Documents. At KFM I only see the folder icons. Can I customize this?
Thank you for your Feedback
Greetings, Beat

Clayman
Clayman
5 years ago

I am using your script and trying to Redirect the Downloads folder also I have added the line and copy content. I get an error message.
Test-Path : Cannot bind argument to parameter ‘Path’ because it is null here is part of the script I am using. What am I doing wrong. @{“knownFolderInternalName” = “Downloads”;”knownFolderInternalIdentifier”=”Downloads”;”desiredSubFolderNameInOnedrive”=”Downloads”;”copyContents”=”true”},

I’ve also added Downloads in $KnownFolders and Set-knowfolderPath

Beat
Beat
5 years ago

It is possible to redirect the OneDrive to another drive?

Nick
Nick
5 years ago

Will this work if the documents location is already redirected to a share on a server?

Beat
Beat
5 years ago

The script works great. Is it possible to redirect the Desktop, Documents and Pictures folders to a subfolder (e.g. Profile) on the OneDrive?

Ben
Ben
5 years ago

It works 🙂
Thank you Jos for the great work!

Devaki Priya
Devaki Priya
5 years ago

Hi,

I used your script to auto configure onedrive. it works great. but users started reporting that they are missing desktop files. Desktop files resides in C:\Users\username\Desktop and not in C:\Users\username\OneDrive – companyname\Desktop. Can you help me redirect user desktop files to onedrive folder.

Ben
Ben
5 years ago

Hi Jos,
You’ve done a great job with this script en can help me a lot 🙂 -> I’m a bit a newcomer in the world of Powershell but trying to learn and understand, and now I’m struggling how and where to set the ‘Get/Set-KnownFolderPath’ function to redirect the folders. Even Google can’t help me out on this one. Can you please clarify how and where to properly configure the arrays mentioned in line 18?
Thanks in advance!

chintan
chintan
6 years ago

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 ?

Joel
Joel
6 years ago

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

Sam
Sam
6 years ago

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?

Jan
Jan
6 years ago

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.

PriyaGop
PriyaGop
5 years ago

Hi Jos,

Great script, I tested it in a couple of our test Windows 10 machines and it works great! I am new to PowerShell and might need your support.

This script syncs files/ folders from cloud to PC as well. Can we restrict that? Can this script be modified to make sync only from PC to onedrive cloud?

Please assist

Microsoft 365, Azure, Automation & Code

38
0
Would love your thoughts, please comment.x
()
x