In Windows 10 Onedrive is builtin, in some scenarios you don’t want to use it as, for instance if you use both Onedrive and Onedrive for Business installed as that is confusing for the user. Yes, you can turn of Onedrive using a Group Policy but the Onedrive Setup will run for every user creating a profile on the system anyway. In many scenarios we don’t want it to run at all.
How does this work then? In the default user profile there is a Run Command in the registry the runs for every user creating logging on to the computer.
What we use is the old trick in the book, to mount the default user profile during OS Deployment and simply delete the Run command from the registry then it will not execute at all for any user. We create a .cmd file with the following command lines to first mount the default user registry, remove the command and unmount it.
The .cmd file can be downloaded here: removeOnedrive.cmd
To implement it:
1. Download the file and copy it to a folder that you can use as a package Source for a package in Configuration Manager.
2. Rename the file to “RemoveOneDrive.cmd”
3. In Configuration Manager create a new package with the newly created folder as the source folder.
5. Then we distribute the content if you haven’t automated it already like I do 😉 :https://ccmexec.com/2015/08/powershell-automatically-copy-packages-to-dp-in-configuration-manager-2012/
6. Add a step to the Task Sequence to run the command, I like to use the Run Command Line step but you could create a program as well if you like. Note: It has to run after a reboot to the full OS, it cannot be run in WinPE.
Then you are ready to test the deployment.
Hello , thanks for this but i was just curious can you run this in a inplace upgrade task sequence as well ?
Thanks
Mike
This script had been working nicely until I made the latest updates in v1607. I now get a error in my task sequence for this step.
Added the following line to the batch file to remove Onedrive shortcut from Start Menu:
del “C:\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\onedrive.lnk”
I put this batch file in the last of OSD task sequence, seems it stuck like forever?