How to Easily Monitor OneDrive KFM Migration Status

Table of Contents

Introduction

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.

Advertisements

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.

				
					#Check if GPO has been applied and configured to move to OneDrive
$KFMRegistryExists = Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\OneDrive" -Name "KFMSilentOptIn"
if ($KFMRegistryExists){
    $KFMRegistry = "Healthy"
}
else{
    $KFMRegistry = "KFM Registry is not set"
    return $KFMRegistry
}

#Check what the current Documents path is and compare it to expected OneDrive path
$KFMDocumentsActualPath = (Get-ItemProperty -path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -name "Personal").Personal
if ($KFMDocumentsActualPath -eq ($ENV:OneDrive + "\Documents")) {
    $KFMDocumentsInOneDrive = "Healthy"
}
else {
    $KFMDocumentsInOneDrive = "Documents folder not configured to OneDrive"
    return $KFMDocumentsInOneDrive
}

#Test whether OneDrive path exists
if (Test-Path $KFMDocumentsActualPath) {
    $KFMOneDriveExists = "Healthy"
}
else{
    $KFMOneDriveExists = "OneDrive path does not exist"
    return $KFMOneDriveExists
}
$KFMIsHealthy = $True
$KFMIsHealthy
				
			

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.

Advertisements

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, 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.

Advertisements

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.

				
					select SMS_R_USER.ResourceID,SMS_R_USER.ResourceType,SMS_R_USER.Name,SMS_R_USER.UniqueUserName,SMS_R_USER.WindowsNTDomain from SMS_R_User where SMS_R_User.UserGroupName = "DOMAIN\\Group Name"
				
			

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.

Advertisements

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.

Summary

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!

Advertisements

References

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 One Comment

  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.

Leave a Reply