Deploying the new Onedrive Next Generation Sync client as MSI through Intune to Windows 10

Onedrive for Business’s client, the new Next Generation Sync client, is awesome. Obviously.

So you want it on your devices, but Microsoft distributes it as .exe. Nasty, because I want to manage Windows 10 as mobile devices through Intune, and that only allowes me to distribute as MSI.

I created an MSI for Onedrive for Business’s Next Generation Client using Advanced Installer. Because I’m not allowed to redistribute Microsoft’s .exe, this MSI downloads the .exe from Microsoft’s website, it uses /silent and /takeover as installation switches.

This is the installer that self-downloads Onedrive NGen: OnedriveNGSC.msi (right click, save as).

Optionally, you can change the URL from which the .exe installer is downloaded by supplying downloadURI as parameter to the MSI. (e.g. msiexec /i OnedriveNGSC.msi downloadURI=”http://www.example.com/file.exe”)

The MSI is an empty placeholder for the following Powershell script:

 

Param(
$downloadURI
)

function runProcess ($cmd, $params, $windowStyle=1) {
    $p = new-object System.Diagnostics.Process
    $p.StartInfo = new-object System.Diagnostics.ProcessStartInfo
    $exitcode = $false	
    $p.StartInfo.FileName = $cmd
    $p.StartInfo.Arguments = $params
    $p.StartInfo.UseShellExecute = $False
    $p.StartInfo.RedirectStandardError = $True
    $p.StartInfo.RedirectStandardOutput = $True
    $p.StartInfo.WindowStyle = $windowStyle; #1 = hidden, 2 =maximized, 3=minimized, 4=normal
    $null = $p.Start()
    $output = $p.StandardOutput.ReadToEnd()
    $exitcode = $p.ExitCode
    $p.Dispose()	
    $exitcode
    $output
}

#download the client
$exePath = Join-Path $Env:Temp "onedriveNGSC.exe"
try{
		invoke-webrequest $downloadURI -OutFile $exePath -ErrorAction Stop
}catch{
		Throw "Failed to download the installer from $downloadURI"
}

$res = runProcess $exePath "/silent /takeover"

#check if return code is 0
if(0 -ne $res[0]){
		Throw "Failed to install client: $($res[0]) $($res[1])"
}

6
Leave a Reply

avatar
3 Comment threads
3 Thread replies
3 Followers
 
Most reacted comment
Hottest comment thread
4 Comment authors
JosPiotr ZacharzewskiDavidMike Recent comment authors

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
newest oldest most voted
Notify of
Piotr Zacharzewski
Guest
Piotr Zacharzewski

What about deploying as a ‘Office 365 ProPlus’ type of app – and selecting only ‘OneDrive Desktop’ App?

David
Guest
David

Hi Jos. Thank you for the script. I see that it downloads “onedriveNGSC.exe” and places it in the Appdata\Local\Temp folder of the user running it. I see in the PS code the line $exePath = Join-Path $Env:Temp “onedriveNGSC.exe”. What I can’t figure out is that where it’s getting (downloading) that .exe from. That exe is version 18.065 (as of this comment). I’d like to install version 18.091. Is there a way to change the exe that it downloads? Specifying a URL with the “downloadURI” doesn’t seem to work. I have tried msiexec /i OnedriveNGSC.msi downloadURI=”https://go.microsoft.com/fwlink/?linkid=860984 ” It seems like it… Read more »

Mike
Guest
Mike

Hi Jos – great blog! I was hoping you could provide some more detail on “The MSI is an empty placeholder for the following Powershell script.” How did you use Advanced Installer to create a placeholder? I’ve looked at many of your other posts that explain using Advanced Installer in more detail, but couldn’t figure this one out. Thanks in advance for the feedback!