Remove Microsoft OneDrive from Windows 10

As system administrators, we are commonly called upon to simplify the experience for our users. OneDrive is definitely a complication for everyone who doesn’t use it, or want it. It’s one of the first questions many Windows 10 users ask me about. When I first started running into the issue, I would just fix it one by one, but that became cumbersome, and I found that many of the resources I read missed steps that seemed at first to work, but later turned out to be incomplete, or just plain inaccurate. Now, it is still possible that something else will change in the Windows Operating System, or in OneDrive, that may make even this solution incomplete. If I discover that issue somewhere down the line, I will endeavor to update this post with new details.

Before we go on – if you are not a highly technically proficient user (preferably a professional or well trained Windows system administrator), I encourage you to stop now and call someone to help you. And, of course, make a backup of your system and/or registry before you continue. I am not here to support anyone but my paying customers, so I won’t be watching closely for comments. This is strictly informational to help IT Professionals to get their jobs done quickly. For those of you who know what to do with the following – have at it; I hope it helps.

Batch/CMD File

set ODx86=”%systemRoot%\System32\OneDriveSetup.exe”
set ODx64=”%systemRoot%\SysWOW64\OneDriveSetup.exe”

taskkill /f /im OneDrive.exe

timeout /T 10

if exist %ODx64% (
%ODx64% /uninstall
) else (
%ODx86% /uninstall

timeout /T 10

rd “%userprofile%\OneDrive” /q /s
rd “%LOCALAPPDATA%\Microsoft\OneDrive” /q /s
rd “%ProgramData%\Microsoft OneDrive” /q /s

reg ADD HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6} /t REG_DWORD /v System.IsPinnedToNameSpaceTree /d
0 /f

REG ADD HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6} /t REG_DWORD /v
System.IsPinnedToNameSpaceTree /d 0 /f

System.IsPinnedToNameSpaceTree /d 0 /f

REG DELETE HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{018D5C66-4533-4307-
9B53-224DE2ED1FE6} /f

set “ODx86=”
set “ODx64=”

timeout /t 20

Sources :

The script above was compiled from a variety of sources, most notable are those listed below :