OneDrive Business KFM Known Folder Move without GPOs via Powershell

The estimated reading time 4 minutes

OneDrive Business KFM Known Folder Move without GPOs via Powershell

Hi everyone,

OneDrive for Business is developing all the time and got a new feature which is known as KMF (Known Folder Move). This feature was release in late june 2018 with release  18.111.0603.0004.

So what does it mean? This little feature allows you to sync all the content of your document, pictures and desktopfolder to onedrive business. So microsoft gives an alternative to the old folder redirection which has one important benefit. KFM does not move folder to servers it only syncs his content, so the folders and files are still on your computer. You can access the files also in offline mode, on a laptop without VPN or something else. 

Lets have a look at the releases of onedrive business clients

OneDriveReleases

in the latest release note you can see that enterprise ring propably will get the update for KFM in september 2018.

Finding out the release is pretty easy in onedrive-> rightclick on the onedrive icon in the taskbar -> settings->info

On my working machine the client has a higher release so I can use the KFM but I did not find any button to active it. So I read some articles and found out that you can use it with GPOs but I only have Azure AD and there are no gpos.

You may have a look at this article from MS

As mentioned you can do it via gpos (first you have to import admx templates on dc blablabla…) but this is not the way I did. The article talks about one registry key with a value. So why shouldn’t we set it via powershell? (setting regkeys manual is boring)

What do we need to accomplish the goal? We need to set the registry key and in there a value that is the office 365 tenant id? hmm sounds easy.

To get the O365 tenant id I wrote the following short sixliner 🙂

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

NOTE: You need to have internetconnection to download the powershell module for azure ad. The script also asks for O365 account. You can use any normal user in your o365 tenant.

After we have the tenant id, we can do our job with this script in ISE. There is some “error handling” in searching for the path.

$path = "HKLM:\SOFTWARE\Policies\Microsoft\"
$onedrivepath = "HKLM:\SOFTWARE\Policies\Microsoft\OneDrive"
$testpath = Test-Path -Path "HKLM:\SOFTWARE\Policies\Microsoft\OneDrive"
if($testpath -eq $false){
  Install-Module AzureAD -Scope CurrentUser -Force
  Import-Module AzureAD -Force 
  $login = Connect-AzureAD
  $tentantid =($login.TenantId.Guid)
  Disconnect-AzureAD
  New-Item -Path "$path" -Name OneDrive -Force 
  New-ItemProperty -Path "$onedrivepath" -Name "KFMOptInWithWizard" -Value "$tentantid" -Force
}else{
  Write-Host "registry key already exists, nothing's done!" -ForegroundColor Yellow
 }

If you only want to set that f***ng registry key then you can execute a powershell as admin and copy this code.

$path = "HKLM:\SOFTWARE\Policies\Microsoft\"
$onedrivepath = "HKLM:\SOFTWARE\Policies\Microsoft\OneDrive"
Install-Module AzureAD -Scope CurrentUser -Force
Import-Module AzureAD -Force 
$login = Connect-AzureAD
$tentantid =($login.TenantId.Guid)
Disconnect-AzureAD
New-Item -Path "$path" -Name OneDrive -Force 
New-ItemProperty -Path "$onedrivepath" -Name "KFMOptInWithWizard" -Value "$tentantid" -Force

After the key with the value was set please reboot the machine. so the onedrive client asks you which folders you want to sync with onedrive business.

NOTE: if you have .one Files from onenote in your documents, you have to move them to another place. 

See this link

Also the settings menu was added another ribbon.

By opening explorer you should now be able to see the green hook beside the folders desktop, pictures and documents.

 

As you can see, it is possible to get that feature without ad, but with gpos it is much easier for sure.

Push the “helpful” button if you liked my article and have a look at others.

Have fun with syncing.

 

Print Friendly, PDF & Email
Was this article helpful?
YesNo
0 0 votes
Article Rating
Subscribe
Notify of
guest
5 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
trackback
2 years ago

[…] OneDrive Business KFM Known Folder Move without GPOs via … […]

Aaron
Aaron
3 years ago

I have searched the net and I cannot find any answers to a very simple question, if you enable KFM using the registry key on a device, how can you disable it?

I have tried setting the following options to 0 but no luck.
KFMSilentOptInDesktop
KFMSilentOptInDocuments
KFMSilentOptInPictures

As soon as I sign into OneDrive on that account it automatically syncs all 3 folders

Brad F Pinkston
Brad F Pinkston
4 years ago

Super helpful article. I’m managing some BYOD devices running Win 10 Home. Due to that, some will already have OneDrive running and linked to a personal account. How do I force that to be signed out via Powershell? Any thoughts?