OneDrive for Business Known Folder Moves without GPO


I thought I would write a post about something different. I am working on a project to move users Documents, Desktop and Pictures to OneDrive for business but this is simple you may say, you just configure a GPO to redirect these known folders. What about when you cannot get to the office? At this current time everyone is on lockdown and we are being told to work from home or you may have users that never need to go to the office and are using their own device. Either way we can configure user’s devices to sync data to OneDrive without GPOs. See how to do it below.

We use a PowerShell script and execute it on the remote devices. This can be done either manually as an administrator or using an RMM tool. In this case we used Datto.

First of all we need to get the Microsoft 365 Tenant ID – here is some PowerShell you can use to gather this information: – you will need to know the Tenant Global Admin credentials for this to work:

Install-Module AzureAD -Scope CurrentUser -Force
Import-Module AzureAD -Force 
$login = Connect-AzureAD
$tentantid =($login.TenantId.Guid)

Copy and Paste the Tenant ID into the script below:
$path = "HKLM:\SOFTWARE\Policies\Microsoft\"
$onedrivepath = "HKLM:\SOFTWARE\Policies\Microsoft\OneDrive"
$tentantid = "8edaf648-****-****-****-************"
New-Item -Path "$path" -Name OneDrive -Force
#New-ItemProperty -Path "$onedrivepath" -Name "KFMOptInWithWizard" -Value
 "$tentantid" -Force
New-ItemProperty -Path "$onedrivepath" -Name "KFMSilentOptin" -Value 
"$tentantid" -Force
New-ItemProperty -Path "$onedrivepath" -Name "KFMSilentOptinWithNotification" 
-Value "1" -PropertyType DWORD -Force
New-ItemProperty -Path "$onedrivepath" -Name "FilesOnDemandEnabled" -Value "1" 
-propertytype DWORD -force
Restart-Computer -Force


Below is a table detailing what the Item Properties actually do:

Item Property Details
KFMSilentOptin This setting redirects users’ Documents, Pictures, and Desktop folders to OneDrive without any user interaction. This setting is available in the OneDrive sync app build 18.111.0603.0004 or later. Before sync app build 18.171.0823.0001, this setting redirected only empty known folders to OneDrive. Now, it redirects known folders that contain content and moves the content to OneDrive.
KFMSilentOptinWithNotification This setting displays a notification to users after their folders have been redirected.


FilesOnDemandEnabled This setting lets you control whether OneDrive Files On-Demand is enabled for your organization. Files On-Demand helps you save storage space on your users’ computers and minimize the network impact of sync. The feature is available to users running Windows 10 Fall Creators update (version 1709 or later).

File contents don’t download until a file is opened.

You will notice that on of the lines in the script is # out  You could use this line instead of the KFMSilentOptin.

KFMOptInWithWizard If you enable this setting and provide your organization ID, users who are syncing their OneDrive see the following window when they’re signed in. If they close the window, a reminder notification appears in the Activity Center until they move all their known folders. If a user has already redirected their known folders to a different OneDrive account, they are prompted to direct the folders to the account for your organization (leaving existing files behind).