Deploy OneDrive Next Generation sync client with ConfigMgr


For businesses and organizations that have taken the path to cloud with Office 365, have most likely heard about the OneDrive for Business sync client. It’s unfortunately well known that this client had it’s drawbacks and Microsoft have been aware of this for some time now. A while back, the released what’s referred to as the OneDrive Next Generation sync client. It offered a lot of improvements, but was it demanded custom installations wrappers to deal with various command and registry keys. Yesterday, Microsoft released a new version of the OneDrive Next Generation sync client (17.3.6390.0509) with improvements to the deployment experience for administrators. The OneDrive Next Generation sync client offers end users to add both personal accounts and work accounts, all in the same sync client.

Microsoft has provided a short guide for how this new version can be deployed with ConfigMgr, however the method they’ve shared for the script detection method is not something that I’d recommend to my customers. It has a few flaws, for instance it doesn’t check the version of OneDrive.exe in addition to that it doesn’t determine the correct user profile path. This got me writing this post, so that administrators out there can be successful in their OneDrive Next Generation sync client deployments with ConfigMgr.

Download the OneDrive Next Generation sync client

The OneDrive Next Generation sync client can be downloaded from the following site:

Script Detection Method

Below is my take on how the script detection method used for the OneDrive Next Generation sync client should look like. This script gets the current logged on user and determines the profile path by matching the user name with the SID information in the UserProfileList registry keys. When the correct user profile path has been determined, it then validates the if the OneDrive.exe exists and is of the specified version. Remember, the script detection method should only output to the STDOUT (done by returning data to the pipeline in PowerShell) if the OneDrive.exe file exists. When the detection method is invoked prior to installing the application, if the OneDrive.exe file doesn’t exist it shouldn’t output anything which is interpreted by ConfigMgr as Not Installed.

Remember to define the minimum required version in the script from below, that you want to support. On a side note, the script below gets the logged on user name from the Win32_ComputerSystem class. The UserName property is only populated with a value if the user is logged on locally (console). When a user is logged on through RDP, the UserName property will be empty. That’s something to keep in mind.

# Set ErrorActionPreference
$ErrorActionPreference = "SilentlyContinue"

# Determine current logged on user
$UserName = Get-WmiObject -Class Win32_ComputerSystem | Select-Object -ExpandProperty UserName

# Create a hash-table for each UserProfileList with translated SIDs
$ProfileTable = @{}
$UserProfileListItems = Get-ItemProperty -Path "Registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\ProfileList\*"
foreach ($UserProfileListItem in $UserProfileListItems) {
    $SecurityIdentifier = New-Object -TypeName System.Security.Principal.SecurityIdentifier($UserProfileListItem.PSChildName)    
    $UserNameTranslated = $SecurityIdentifier.Translate([System.Security.Principal.NTAccount])
    if ($UserNameTranslated -ne $null) {
        $ProfileTable.Add($UserNameTranslated.Value, $UserProfileListItem.ProfileImagePath)

# Determine user profile path from current logged on user
$UserProfilePath = $ProfileTable[$UserName]

# Construct OneDrive.exe path
$OneDrivePath = Join-Path -Path $UserProfilePath -ChildPath "\AppData\Local\Microsoft\OneDrive\OneDrive.exe"

# Validate OneDrive.exe file exists and check version
if (Test-Path -LiteralPath $OneDrivePath) {
    # Load required assembly to perform version check

    # Set minimum required version
    $OneDriveRequiredVersion = New-Object -TypeName System.Version -ArgumentList "17.3.6390.0509"

    # Get existing OneDrive.exe version
    $CurrentOneDriveVersion = New-Object -TypeName System.Version -ArgumentList ((Get-Item -LiteralPath $OneDrivePath).VersionInfo | Select-Object -ExpandProperty FileVersion)

    # Return output to STDOUT if current OneDrive.exe version is higher than the minimum required version
    switch ($CurrentOneDriveVersion.CompareTo($OneDriveRequiredVersion)) {
        0 { return $true }
        1 { return $true }

Create an Application in ConfigMgr

Even though the Microsoft official blog included a walk-through of how to create an Application in ConfigMgr for the OneDrive Next Generation sync client, I’ll add it as well just to point out how to leverage my improved script detection method.

1. Download the installation for OneDrive Next Generation sync client and store it in the Content Library.
2. In the ConfigMgr console, select to create a new Application.
3. Select Manually specify the application information and click Next.
4. Enter the application details and click Next.
5. Enter the Application Catalog details and click Next (dont forget the icon!).
6. On the Deployment Types page, click Add.
7. Select Script Installer as Type and click Next.
8. Enter the name for the Deployment Type and click Next.
9. Enter the content location and configure the Installation program text field to contain “OneDriveSetup.exe” /Silent. Click Next.
10. On the Detection Method page, select Use a custom script to detect the presence of this deployment type and click Edit. Note, this is important and you’ll need to do this in order to successfully deploy the OneDrive Next Generation sync client.
11. Select PowerShell as the Script type and copy the script detection method from earlier in this post into the Script contents field. Click OK.
12. Verify that the Script type and Script length fields have been updated and click Next.
13. On the User Experience page, select Install for system as for Installation behavior and make sure to select Only when a user is logged on as the Logon requirement. It’s important that you configure the proper Logon requirement, otherwise the script detection method won’t work. Click Next.
14. On the Requirements and Dependencies pages, configure any desired requirements and dependencies if necessary in your environment and click Next.
15. On the Summary page, click Next.
16. Click Close on the Completion page.
17. Back at the Deployment Types page, click Next.
18. On the Summary page, click Next.
19. And finally on the Completion page, click Close.

Distribute the Application to your Distribution Points and deploy it to a collection of your choice.

End user experience in Software Center

Below is a screenshot from my lab environment where I’m logged on locally, and the OneDrive Next Generation sync client have been installed successfully.



  1. Matt M

    Is there still no method of incorporating this into a machine image?

    We’re looking to use ODfB with folder redirection…but can’t if its a user based install that has to be run after a user is already logged in.

  2. Iliass El Taghadouini

    Hello Peter,

    Great article. Do you know if we can control the installation of updates of the OneDrive client via SCCM (like Office365 client updates) ? Currently there is no control and whenever a new version is available, the client updates itself, which isn’t ideal in an enterprise environment.

    Thanks for your feedback.


  3. Pingback: Install OneDrive NGSC update on Windows 10 in OSD - Deployment Novellas

  4. Brian S

    Looks like there are a few coding issues in your script…

    *You return true for both cases in your switch statement.
    *And compareTo can return a -1 value if Current Version is less than required.

    1. NickolajNickolaj (Post author)

      Hi Brian,

      No, this is by design. I don’t want to install a version that is older than what’s currently deployed.


  5. Jason

    Great article Nickolaj! I followed instructions and everything works except that OneDrive is not installing when the user log on. OD shows up on “Software Center” and status shows “Past Due – Will be installed” but the job never kicks in. However, I can manually start the installation via software center. Any help will be appreciated. I also checked appenforce.log and there seems to be no errors there.


    1. John

      I get the same.
      Can manually hit the “Retry” and it runs correctly; however running a manual “Application Deployment Collection Cycle” refresh and it behaves the same way over and over.

    2. James

      I am also getting the “Past Due-Will be installed”. If I go into Software Center and run the install again manually it works.

  6. Pingback: Onedrive Next Gen deployment with SCCM 2012

  7. Víctor Tomatsu

    Hello Nickolaj ,

    I was deploying “OneDrive Next Generation” with this detección method on a collection of around 300 conputers.

    And 47 conputers showed the next error

    “The application was not detected after installation complete”

    Do you have any reference about this error means??

    Tanks you

    1. Jay Hijazi

      I’m having the same issue… getting a “The application was not detected after installation complete” error.

      Any ideas?

  8. Pingback: SCCM - OneDrive Next Generation Sync Client - TechyGeeksHome

Leave a Comment

Your email address will not be published. Required fields are marked *