How to Fix: Uninstall OneDrive Permanently (Win10 Home, Pro)

Dennis Faas's picture

Infopackets Reader Jean S. writes:

" Dear Dennis,

I am running Windows 10 Home and I want to disable OneDrive permanently. I have reviewed many so-called guides online and it seems that you need to have Windows 10 Pro or higher to disable One Drive from reinstalling using the Group Policy Editor (gpedit.msc). Therefore, the only option for Windows 10 Home users is to uninstall One Drive manually - however, each time Windows makes a major update, OneDrive comes back and starts sucking up my data bandwidth, and slows my machine down. Is there any way to uninstall OneDrive permanently? "

My response:

It is possible to remove One Drive permanently using a special script that I wrote - and will definitely work using Windows 10 Home or Pro (32bit or 64bit) using the same set of instructions.

I asked Jean if he would like me to connect to his machine using my remote desktop support service in order to roll out the script, and he agreed.

Below I'll discuss how things work.

How to Fix: Uninstall OneDrive Permanently (Win10 Home, Pro)

As Jean mentioned, many of the "guides" online won't help Windows 10 Home users permanently uninstall OneDrive because Microsoft reinstalls it the next time a major update to Windows 10 is released. There is a way around this issue using the Windows icacls command to forcefully restrict access on directories and executables.

Without getting too technical, my script below makes directories in place of OneDrive executables, then block access to the directories using icacls permissions. This essentially stops OneDrive in its tracks if it ever tries to (sneakily) reinstall itself even if you didn't ask for it.

I have tested this on my own system and it works great. I also undid the changes and was able to get OneDrive to install again.

READ CAREFULLY: the script below does NOT delete user data. It only cripples the OneDrive executable and OneDrive folders, which prevents it from reinstalling after the next major Windows 10 feature update. When OneDrive is disabled, you will still retain a copy of your local files on the system. If you are still paranoid about losing any data, backup your entire hard drive before committing. To be clear: NO WARRANTY IS IMPLIED - I take no responsibility if anything breaks. I have, however, used this script hundreds of times (even 3 years after publishing this article) and it works as intended.

To disable One Drive permanently in either Windows 10 Home or Pro 32 or 64 bit, do the following:

  1. Click Start, then type in "cmd" (no quotes); wait for "CMD.EXE" or "Command Prompt" to appear in the list, then right click it and select "Run as Administrator".
     
  2. Highlight the text below using your mouse:

    rem task kill one drive if running; uninstall onedrive permanently; delete onedrive executable
    rem clean user directories; delete onedrive registries
    rem this script came from https://www.infopackets.com

    taskkill /f /im OneDrive.exe
    %SystemRoot%\System32\OneDriveSetup.exe /uninstall
    %SystemRoot%\SysWOW64\OneDriveSetup.exe /uninstall

    echo hi

    rem pause 25 seconds here and wait for uninstall to complete
    ping 127.0.0.1 -n 25 > nul

    takeown /f %SystemRoot%\System32\OneDriveSetup.exe >out.txt
    icacls %SystemRoot%\System32\OneDriveSetup.exe /reset /T >out2.txt
    takeown /f %SystemRoot%\SysWOW64\OneDriveSetup.exe >out.txt
    icacls %SystemRoot%\SysWOW64\OneDriveSetup.exe /reset /T >out2.txt
    del /f /q %SystemRoot%\System32\OneDriveSetup.exe
    del /f /q %SystemRoot%\SysWOW64\OneDriveSetup.exe

    rmdir "%UserProfile%\OneDrive" /Q /S
    rmdir "%LocalAppData%\Microsoft\OneDrive" /Q /S
    rmdir "%ProgramData%\Microsoft OneDrive" /Q /S
    rmdir "C:\OneDriveTemp" /Q /S

    REG Delete "HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f
    REG Delete "HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f

    echo hi

    rem block EXEs by creating folders with same .EXE names

    mkdir %SystemRoot%\System32\OneDriveSetup.exe
    mkdir %SystemRoot%\SysWOW64\OneDriveSetup.exe
    mkdir "%UserProfile%\OneDrive"
    mkdir "%LocalAppData%\Microsoft\OneDrive"
    mkdir "%ProgramData%\Microsoft OneDrive"
    mkdir "C:\OneDriveTemp"

    echo hi

    rem set deny permissions on directories

    icacls %SystemRoot%\System32\OneDriveSetup.exe /inheritance:r /deny "Everyone:(OI)(CI)(F)" "ANONYMOUS LOGON:(OI)(CI)(F)"
    icacls %SystemRoot%\SysWOW64\OneDriveSetup.exe /inheritance:r /deny "Everyone:(OI)(CI)(F)" "ANONYMOUS LOGON:(OI)(CI)(F)"
    icacls "%UserProfile%\OneDrive" /inheritance:r /deny "Everyone:(OI)(CI)(F)" "ANONYMOUS LOGON:(OI)(CI)(F)"
    icacls "%LocalAppData%\Microsoft\OneDrive" /inheritance:r /deny "Everyone:(OI)(CI)(F)" "ANONYMOUS LOGON:(OI)(CI)(F)"
    icacls "%ProgramData%\Microsoft OneDrive" /inheritance:r /deny "Everyone:(OI)(CI)(F)" "ANONYMOUS LOGON:(OI)(CI)(F)"
    icacls "C:\OneDriveTemp" /inheritance:r /deny "Everyone:(OI)(CI)(F)" "ANONYMOUS LOGON:(OI)(CI)(F)"

    echo hi
     
  3. Right click the above highlighted text, then select "Copy" from the dialogue menu.
     
  4. Next, right click in the middle of the administrative command prompt window and select "Paste". The text you copied in Step #2 should be output to the command line. Once the script is finished, OneDrive should be permanently disabled. Don't worry if you see any error messages as this script is designed to work for both Windows 10 32bit and 64bit. Optionally continue on with Step #5.
     
  5. You can attempt to download and install OneDrive manually. You will either get an error message that "OneDrive couldn't be installed" with Error code 0x80070005, or it will simply not do anything.

If you want to undo the changes, read the next section.

How to Reinstall After You Remove OneDrive Permanently

To Reinstate OneDrive, you will need to reset permissions on the directories, delete the directories, then reinstall OneDrive.

To do so:

  1. Click Start, then type in "cmd" (no quotes); wait for "CMD.EXE" or "Command Prompt" to appear in the list, then right click it and select "Run as Administrator".
     
  2. Highlight the text below using your mouse:

    rem undo permissions
    rem this script came from https://www.infopackets.com

    takeown /f %SystemRoot%\System32\OneDriveSetup.exe >out.txt
    icacls %SystemRoot%\System32\OneDriveSetup.exe /reset /T >out2.txt
    takeown /f %SystemRoot%\SysWOW64\OneDriveSetup.exe >out.txt
    icacls %SystemRoot%\SysWOW64\OneDriveSetup.exe /reset /T >out2.txt
    takeown /f "%UserProfile%\OneDrive" >out.txt
    icacls "%UserProfile%\OneDrive" /reset /T >out2.txt
    takeown /f "%LocalAppData%\Microsoft\OneDrive" >out.txt
    icacls "%LocalAppData%\Microsoft\OneDrive" /reset /T >out2.txt
    takeown /f "%ProgramData%\Microsoft OneDrive" >out.txt
    icacls "%ProgramData%\Microsoft OneDrive" /reset /T >out2.txt
    takeown /f "C:\OneDriveTemp" >out.txt
    icacls "C:\OneDriveTemp" /reset /T >out2.txt

    rem delete directories

    rmdir %SystemRoot%\System32\OneDriveSetup.exe
    rmdir %SystemRoot%\SysWOW64\OneDriveSetup.exe
    rmdir /q /s "%UserProfile%\OneDrive"
    rmdir /q /s "%LocalAppData%\Microsoft\OneDrive"
    rmdir /q /s "%ProgramData%\Microsoft OneDrive"
    rmdir /q /s "C:\OneDriveTemp"

    echo hi
     
  3. Right click the above highlighted text, then select "Copy" from the dialogue menu.
     
  4. Next, right click in the middle of the administrative command prompt window and select "Paste". The text you copied in Step #2 should be output to the command line. Don't worry if you see any error messages as this script is designed to work for both Windows 10 32bit and 64bit.
     
  5. You can now download and install OneDrive manually. It should install without any issues.

I hope that helps.

Additional 1-on-1 Support: From Dennis

If all of this is over your head, or if you need help to uninstall OneDrive permanently, I can help using my remote desktop support service. Simply contact me, briefly describing the issue and I will get back to you as soon as possible.

Got a Computer Question or Problem? Ask Dennis!

I need more computer questions. If you have a computer question - or even a computer problem that needs fixing - please email me with your question so that I can write more articles like this one. I can't promise I'll respond to all the messages I receive (depending on the volume), but I'll do my best.

About the author: Dennis Faas is the owner and operator of Infopackets.com. With over 30 years of computing experience, Dennis' areas of expertise are a broad range and include PC hardware, Microsoft Windows, Linux, network administration, and virtualization. Dennis holds a Bachelors degree in Computer Science (1999) and has authored 6 books on the topics of MS Windows and PC Security. If you like the advice you received on this page, please up-vote / Like this page and share it with friends. For technical support inquiries, Dennis can be reached via Live chat online this site using the Zopim Chat service (currently located at the bottom left of the screen); optionally, you can contact Dennis through the website contact form.

Rate this article: 
Average: 4.6 (9 votes)

Comments

kitekrazy's picture

Maybe it's worth upgrading to Pro to avoid headaches.

Dennis Faas's picture

Upgrading to Pro just to disable OneDrive isn't an option for those who own Home and can't afford the upgrade (or don't see the need to pay for such a feature). If you search the Google for this specific question, you will see hundreds of people complaining that they can't disable OneDrive on Windows 10 Home. That is the reason for making this post. It is not difficult to implement as you suggest - all that is needed is to copy and paste to the command line.

kitekrazy's picture

I will bookmark this. But will One Drive make it's way back when they update the OS?

Dennis Faas's picture

I ran my script to block OneDrive, then I updated to Windows 10 October Update on my virtual machine and can confirm that OneDrive is still blocked from installing.

The update however did successfully remove locks on the following locations:

%SystemRoot%\SysWOW64\OneDriveSetup.exe
"%ProgramData%\Microsoft OneDrive"

The other remaining locks are still in place and thus prevent OneDrive from installing.

landonmlively_15223's picture

The script definitely worked for removing OneDrive, but I didn't realize Win10Home was running EVERYTHING off of OneDrive. Even the desktop was inaccessible.

This all started when I uploaded several years worth of photos from my phone. About 100 gigs. Got the error saying my OneDrive was full. I don't want to use OneDrive, so I'm sure not paying a sub to upgrade it. When I removed it, though, I couldn't do much with the machine.
No desktop, no pictures folder, documents folder, etc... I even created a new folder on the hard drive and tried to re-upload the pics from my phone straight to the hard drive. System couldn't connect to my phone. So apparently, even that goes through OneDrive.

I'm more annoyed about OneDrive now than I was before...
Do you have any tutorials about how to remove friggin' OneDrive and still be able to use the machine in a mostly normal way?

Thanks!
-Landon

Dennis Faas's picture

RE: Do you have any tutorials about how to remove OneDrive and still be able to use the machine in a mostly normal way?

The script removes the onedrive executable so you can use the system without everything being uploaded to the cloud. That said, your %userprofile% directory will still have a "onedrive\desktop" and "onedrive\documents" and "onedrive\documents" folder in it and your data may still reside there. The script **DOES NOT** delete this data as I've mentioned already. These are symbolic links and the system should still operate fine without the onedrive executable. If you don't want the data pointing there you will need to modify the paths either using Windows Libraries and/or use a registry edit.

Note that this is beyond the scope of this article.