Table of Contents


Right now, there are a lot of projects going on about moving data to the cloud. Since more business is getting into Microsoft 365, it is an excellent opportunity to utilize more of the licenses you are already paying for.

A typical scenario where this is true is when companies move the known folders for their users to OneDrive.
There are many ways of performing this move, and you usually want to use OneDrive Known Folder Move (KFM) to keep folders backed up.

Usually, in a “legacy” environment, you configure these folders to store data on a file server. You accomplish this by using Group Policy objects and Folder Redirection to configure the clients to use the server share.

The logical step is to disable Folder Redirection and enable OneDrive KFM.

But what happens when you enable OneDrive KFM for users?
How can you monitor OneDrive KFM migration status and verify that your users have their Known folders in OneDrive?
Right now, there is no native way to verify centrally if the move was successful or not.

Monitoring OneDrive KFM Migration Status

To solve this problem, I looked at the tools available at our business and other businesses. I found that almost everyone has some kind of Enterprise Mobility Management solution to manage their devices.

In our case, Microsoft Endpoint Manager Configuration Manager has the features we need to help us monitor OneDrive KFM migration.

The Solution

During a project, when looking for the best way forward, I found many parts of this puzzle.

It ranged from registry settings to folders and files.

Eventually, I found that a combination of these can be used to determine if Documents had been moved or not.

The script below is used to determine if Documents are moved, but you can add the paths for Desktop and Pictures as well.

If you want to cheat, you can download a zip file with the Baseline here.


Creating the Configuration Item and Baseline

We will start by creating a Configuration Item, followed by Baseline.

We will deploy the Configuration Baseline to a User Collection that contains all the users we want to monitor. Preferably, we want this collection to include all users with a license for OneDrive.

Creating the Configuration Item

Start by opening the MECM Console, go to Assets and Compliance, and expand Compliance Settings.

Right-Click to select Create Configuration Item

Highlighting configuration items

Give it a name you will recognize. I went with OneDrive KFM Migration Status.

Name the configuration item

Select Windows version, in this case, Windows 10.

Click Next and New to create your setting that we want to evaluate for compliance.

We want to give the setting a Name, Setting Type and Data Type.
I went with OneDrive KFM Status, Script and String.

MECM usually runs everything in the System context, and since we want to evaluate for the users, we need to check the box for Run scripts by using the logged on user credentials.

When you got the details completed, click Edit Script and paste in the script from earlier in this post.

Now you are ready to click OK to close the Edit Discovery Script window and change the tab to Compliance Rules. When there, click New to create a rule for the value that we are looking for.

The Operator should be Equals, and the value should be True.

I’m calling my rule OneDrive KFM Status Healthy.

Press OK to save and then proceed through the wizard with Next, Next, and Close.

Creating the Configuration Baseline

Start by opening the MECM Console, go to Assets and Compliance, and expand Compliance Settings.

Right-Click to select Create Configuration Item

Give it a name you will recognize. I went with OneDrive KFM Migration Status again.

Click Add > Configuration Items and select your new Configuration Item.

Click OK to close the wizard and create your Baseline.

Deploying the Configuration Baseline

Since we are interested in the configuration of the users, we need to deploy this to a user collection.

I’m using All Users in my example, but you really should create a separate collection for this specific scenario. I  recommend using an AD group with all licensed users for OneDrive as the target for your query.

I’ve posted an example of the query below. This will get the users from the specified group. Remember to replace DOMAIN and Group Name with your own values.

NOTE: The double \ is intentional, as a single is an escape character in WQL.


Right-click on your Baseline OneDrive KFM Migration Status and click Deploy.

Click Browse and select your collection. As mentioned, I’m using All Users.

Now you are ready to wait for your devices to run the compliance baseline and return their status.

The Evaluation will run after the next Machine Policy Update and then once every seven days.

If you perform a migration, I recommend that you set the schedule to evaluate more often, like once every day.

Monitoring the Baseline Status

Now you are waiting for the clients to move the folders to OneDrive, and to see how you are doing, you can use the Deployments view.

Open the console and go to Monitoring > Deployments and search for the Baseline. I’m searching for OneDrive KFM Migration Status.

Right click the Deployment and select View Status to see the current state.

Monitor OneDrive KFM Migration

How to Manually Trigger a Configuration
Baseline Evaluation

Open Control Panel on a client and Configuration Manager.
Go to the Configurations tab and select the Baseline. Click Evaluate to instantly update the status.
If everything is good, the Compliance State will change to Compliant.


It is actually quite odd that there isn’t any built-in feature that allows us to monitor OneDrive KFM migration status.

Until Microsoft decides to release one, this is the easiest option I’ve managed to find so far.

IT Managers need to know how migration is going, and with this solution, you can present something to indicate the progress and status.

I hope this helps!

If you have any feedback, please leave a comment!


Like this article?

Share on facebook
Share on Facebook
Share on twitter
Share on Twitter
Share on linkedin
Share on Linkdin
Share on pinterest
Share on Pinterest

This Post Has 6 Comments

  1. Bernd Dreyer

    Very valuable treatise after my way of thinking.
    However, I need a script to reset the folder settings to the status before the KFM migration. Doing this in the explorer fails.

  2. Trevor

    Not sure if I’m missing something, but what it the purpose of $KFMIsHealthy? It’s defined at the end of the script but there is no evaluation of whether the other paths (Desktop, Documents, etc.) error. If I remove the $KFMIsHealthy variable entirely and structure the script where no output = success, would you say that is enough confidence of the status?

    1. Niclas Andersson

      The purpose was to return a Boolean if KFM was compliant. You can probably remove $KFMIsHealthy and change the compliance value to $null if you like.
      I had some time constraints and will most likely create a better version in the future.

  3. Mr. X

    Thanks a lot for a great guide!

    Do you have any script to restart sync for the users / computeres that is not completely healthy?

    1. Niclas Andersson

      I’m afraid not. We tried using different registry values for forcing the sync, but it didn’t really work.
      Eventually, it should start by itself.

  4. JC

    Sorry, but i can’t see script code. Thanks.

Leave a Reply