There are quite a few places that OneDrive has buried itself in in Win10. Perform the following steps from a command line on your master(assuming 64-bit OS):
taskkill /f /im OneDrive.exe
Check under the following registry paths for OneDrive active setup keys. If there is one with ComponentID referencing OneDrive with a "StubPath" key - delete the stubpath key.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Active Setup\Installed Components
Load the default NTUSER.dat file and delete OneDrive activesetup stubpath keys in there as well:
HKU\<DEFAULT.dat>\SOFTWARE\Microsoft\Active Setup\Installed Components
HKU\<DEFAULT.dat>\SOFTWARE\WOW6432Node\Microsoft\Active Setup\Installed Components
Delete the directories for OneDrive under all user profiles (especially your Default user profile) and %ProgramData%. Also delete C:\OneDriveTemp.
If you want to remove the OneDrive links from File Explorer delete the two following registry keys if they exist:
I script this all in one .bat file that I run during my image setup. Feel free to do the same.
Also note - make sure you're not installing OneDrive with your office installation as well!
awesome! Thanks a lot. I will test it!
Working on this problem with windows 10 build 1803
You can also delete the run registry key in the default profile
reg load "hku\Profile" "c:\users\Default User\NTUSER.DAT"
reg delete "hku\Profile\Software\Microsoft\Windows\CurrentVersion\Run" /v OneDriveSetup /f
reg unload "hku\Profile"
After deleting the OneDriveSetup key and doing a re-deploy, the Onedrivesetup.exe process will not be loaded.
Great to hear!
You also have the option to change the install method to a system based installation. You need to install OneDrive in your golden image using the /allusers commandline switch and make use of a specific OneDrive version or newer: Install the sync client per machine | Microsoft Docs
This way Onedrive won't be automatically installed one every user login/profile creation.
This option is in preview, so might have issues (although i haven't seen any)
The option to install onedrive on machine base works fine here, we faced some issues with saving the user configs with the result that sometimes the content of the user will be deleted in the cloud without a manual action pfffff....
For more information on that Has anyone successfully installed the OneDrive for Business Client in a non-persistent VDI environment?
the option to install onedrive on machine based is one step forward so that is good news