A lot of organization are moving to Microsoft Office 365 and Windows 10. This is for many reasons such as Windows 7 end of life approaching and organizations are demanding a modern workplace for end users. As part of that Microsoft OneDrive For Business (OD4B) is a common initiative.

While moving to Windows 10 you will find that a part of the estate will still be using Windows 7. For these users, you may want them to realize the benefits of cloud storage and collaboration. If so you will need to deploy the new Sync Client to your Windows 7 estate.

If you are starting your journey into OD4B I recommend having a look at the following resources.

Deploy the New OneDrive Sync Client in an Enterprise Environment: https://support.office.com/en-us/article/Deploy-the-new-OneDrive-sync-client-in-an-enterprise-environment-3f3a511c-30c6-404a-98bf-76f95c519668

Microsoft Ignite video: Deploy the new OneDrive Sync Client – A Practical Guide.

Field notes from Deploying OD4B

If you use the Microsofts Sample ConfigMgr Package which you download and import from here sample SCCM package

You will want to be aware of how the Detection Method works in ConfigMgr. We found with testing that there is an edge case that causes the install to fail if in a remote session.

The detection method provided in the sample package and the TechNet blog (https://blogs.technet.microsoft.com/paulodias/2016/05/24/how-to-deploy-onedrive-next-generation-sync-client-with-sccm/ ). The line of code in the Detection method that fails in a remote session is as follows:

$User = gwmi win32_computersystem -Property Username

The WMI Query works on a device where a user is physically logged in. Yet, if a user logs in remotely and ConfigMgr tries to install OD4B it will fail the detection. The failure is because The WMI query shows the UserName Property is blank. For example:

The application detection failure results in OD4B repeatedly trying to install and fail. If you have notifications on in ConfigMgr this could drive your users mad.

via GIPHY

To Address this our Apps Team created a new simplified detection method. This way is using the tool “Query” to find the active user on a device which works in an RDP context.

# Set ErrorActionPreference $ErrorActionPreference = "SilentlyContinue" $Users = query user For ($i = 1; $i -lt $Users.Count; $i++) { $User = [string]($Users[$i]) If ($User -like "*active*") { $LoggedOnUser = (([string]($Users[$i] | Select-String -pattern "\S+").Matches) -replace ">", "") } } # Validate OneDrive.exe file exists and check version if (Test-Path -LiteralPath "c:\users\$LoggedOnUser\AppData\Local\Microsoft\OneDrive\OneDrive.exe") { return $true }

Or to simplify it more you could use the following (this way it can account for RDP/VDI and also for if the user had a different username to profile name):

if (Test-Path -LiteralPath "$env:LOCALAPPDATA\Microsoft\OneDrive\OneDrive.exe") { return $true }

You will want to test the above options in your environment and extend to having logging.

Let me know if you have any questions.

Cheers,

Harry