I’ve taken information from several sources and written a single “Do It All – Onedrive For Business configuration script” for the Windows 10 Modern Management (Intune MDM Azure AD Join) scenario.
The script can be deployed through Intune to your Windows 10 MDM clients and will do the following silently:
- check latest O4B version and update to it
- detect O4B configuration, start auto config
- completely silent / invisible configuration with SSO
- optionally, enable Files On Demand
- optionally, redirect folders to Onedrive
- optionally, copy old content
O4BClientAutoConfig + source code.
2/27/2019 update: intune now supports starting your scripts as 64 bit!
Let’s say something (like Intune) starts your Powershell script in 32 bit and you really need commands that only 64 bit Powershell has….
#Restart self in x64
Write-Output "Running 32 bit Powershell on 64 bit OS, restarting as 64 bit process..."
$arguments = "-NoProfile -ExecutionPolicy ByPass -WindowStyle Hidden -File `"" + $myinvocation.mycommand.definition + "`""
$path = (Join-Path $Env:SystemRoot -ChildPath "\sysnative\WindowsPowerShell\v1.0\powershell.exe")
Start-Process $path -ArgumentList $arguments -wait
Write-Output "finished x64 version of PS"
Write-Output "Running 32 bit Powershell on 32 bit OS"
With the above at the top of your script, it’ll automatically restart itself if needed 🙂
On a clean install, Windows 10 has ‘suggestions’ in the start menu luring your users into installing stuff like Candy Crush.
If you want to prevent this, put the following PS snippet into a file:
New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SystemPaneSuggestionsEnabled" -Value 0 -PropertyType DWORD -Force | Out-Null
New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-338388Enabled" -Value 0 -PropertyType DWORD -Force | Out-Null
Then head to the Intune Console, go into device configuration and add the above file:
Make sure you let it run in the user’s context:
And finally, assign it to a group (or groups) containing your users.
If you’re using Windows 10 Enterprise or higher Sku’s, you can also use ADMX backed policies as per RKast’s suggestion in the comments below 🙂