straycat19 Posted December 1, 2018 Share Posted December 1, 2018 The author has tested this on his own system and it works great. He also undid the changes and was able to get OneDrive to install again. Warning: He takes no responsibility if anything breaks, as we are essentially circumventing functions of the operating system. I did run tests on this script using a virtual machine at least 10 times, and it worked without a hitch during both reinstall and uninstall of OneDrive. Caveat emptor! To disable One Drive permanently in either Windows 10 Home or Pro 32 or 64 bit, do the following: 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". 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 Right click the above highlighted text, then select "Copy" from the dialogue menu. 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. 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: 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". 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 Right click the above highlighted text, then select "Copy" from the dialogue menu. 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. You can now download and install OneDrive manually (https://onedrive.live.com/about/en-ca/download/). It should install without any issues. Source Link to comment Share on other sites More sharing options...
MrZeb Posted December 1, 2018 Share Posted December 1, 2018 Hi, On recent Windows 10 versions Microsoft allow OneDrive to be Uninstalled like any other program so I don't think this is needed... Link to comment Share on other sites More sharing options...
Pete 12 Posted December 1, 2018 Share Posted December 1, 2018 Very usefull ! Still encountering some reg-files which starting after every reboot , while I removed them before .... What do you know about ; FileSyncEx , and the strange behaviour of some context-items which keep comming back in the contextmenu after reboot , while I removed them before............ ( Open Localisation , Library , with a list of icons with it, etc. ) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.