Remove OneDrive from a Windows 10 & Windows 11 Computer

Remove OneDrive from a Windows 10 & Windows 11 Computer

  • Hi there and welcome to PC Help Forum (PCHF), a more effective way to get the Tech Support you need!
    We have Experts in all areas of Tech, including Malware Removal, Crash Fixing and BSOD's , Microsoft Windows, Computer DIY and PC Hardware, Networking, Gaming, Tablets and iPads, General and Specific Software Support and so much more.

    Why not Click Here To Sign Up and start enjoying great FREE Tech Support.

    This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Welcome to our Community
Wanting to join the rest of our members? Feel free to sign up today.
Sign up

How to Remove OneDrive from a Windows 10 & Windows 11 Computer


Removing OneDrive from Windows can be somewhat challenging due to its deep integration with the operating system, especially in versions like Windows 10 and 11 where it is built-in. While unlinking OneDrive from your PC is relatively straightforward, fully uninstalling or hiding it requires navigating through several settings and steps.

If you do not wish to use OneDrive on your Windows 10 or Windows 11 computer, you can remove it by following these steps. This guide will walk you through the process of unlinking, hiding, and uninstalling OneDrive.


Unlink OneDrive from Your Computer


Unlinking OneDrive will stop it from syncing files between your computer and the cloud without deleting any files.

Windows 10/11:

  • Select the OneDrive cloud icon in your notification area to open the OneDrive pop-up.
  • Click on the Help and Settings icon (usually represented by a gear or three dots).
  • Select Settings.
  • Navigate to the Account tab.
  • Click on Unlink this PC.

Hide or Uninstall OneDrive


If you want to go further and hide or uninstall OneDrive, follow these steps:

Hide OneDrive:

  • Open File Explorer.
  • Right-click on OneDrive in the left sidebar.
  • Select Properties.
  • Under the General tab, check the box next to Hidden.
  • Confirm by clicking OK.

To remove the OneDrive icon from the Notifications area:

  • Open the OneDrive pop-up again by selecting its cloud icon in your notification area.
  • Click on the Help and Settings icon, then select Quit OneDrive.

Uninstall OneDrive:

Windows 10/11:
  • Press the Start button, type “Programs” in the search box, and select Add or remove programs from the list of results.
  • Under Apps & features, find and select Microsoft OneDrive, then click on Uninstall.
  • If prompted for an administrator password or confirmation, provide it.

Additional Steps for Complete Removal:


  • To ensure that OneDrive does not reinstall after an upgrade:
  • Open Settings -> Apps
  • Search for “Microsoft OneDrive”
  • Click on Uninstall

For those who have followed the steps above and OneDrive still did not go away:


Create and run batch file to remove OneDrive:

  • Open a notepad and copy the entire content of the code box below.
  • Do not copy the word code:
  • Paste the text into the notepad.
  • Save the file to your desktop as OneDrive.bat
  • Now you will right click the on OneDrive.bat and run as administrator.

Note: As with any changes to winodws, you should make a restore point prior to following this guide, and always back up your data on a regular basis.
Code:
 @echo off
cls

echo Restoring your personal files to their default original location
xcopy /e "%UserProfile%\OneDrive" "%UserProfile%" > nul

echo Shell Fixing
set "REG_CMD=reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v"

%REG_CMD% "AppData" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\AppData\Roaming" /f > nul
%REG_CMD% "Cache" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\AppData\Local\Microsoft\Windows\INetCache" /f > nul
%REG_CMD% "Cookies" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\AppData\Local\Microsoft\Windows\INetCookies" /f > nul
%REG_CMD% "Favorites" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\Favorites" /f > nul
%REG_CMD% "History" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\AppData\Local\Microsoft\Windows\History" /f > nul
%REG_CMD% "Local AppData" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\AppData\Local" /f > nul
%REG_CMD% "My Music" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\Music" /f > nul
%REG_CMD% "My Video" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\Videos" /f > nul
%REG_CMD% "NetHood" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\AppData\Roaming\Microsoft\Windows\Network Shortcuts" /f > nul
%REG_CMD% "PrintHood" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\AppData\Roaming\Microsoft\Windows\Printer Shortcuts" /f > nul
%REG_CMD% "Programs" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs" /f > nul
%REG_CMD% "Recent" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\AppData\Roaming\Microsoft\Windows\Recent" /f > nul
%REG_CMD% "SendTo" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\AppData\Roaming\Microsoft\Windows\SendTo" /f > nul
%REG_CMD% "Start Menu" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\AppData\Roaming\Microsoft\Windows\Start Menu" /f > nul
%REG_CMD% "Startup" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup" /f > nul
%REG_CMD% "Templates" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\AppData\Roaming\Microsoft\Windows\Templates" /f > nul
%REG_CMD% "{374DE290-123F-4565-9164-39C4925E467B}" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\Downloads" /f > nul
%REG_CMD% "Desktop" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\Desktop" /f > nul
%REG_CMD% "My Pictures" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\Pictures" /f > nul
%REG_CMD% "Personal" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\Documents" /f > nul
%REG_CMD% "{F42EE2D3-909F-4907-8871-4C22FC0BF756}" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\Documents" /f > nul
%REG_CMD% "{0DDD015D-B06C-45D5-8C4C-F59713854639}" /t REG_EXPAND_SZ /d "%%USERPROFILE%%\Pictures" /f > nul

taskkill /f /im OneDrive.exe > nul

echo Using winget to uninstall OneDrive
winget uninstall Microsoft.OneDrive

echo Doing it the old way
"%SystemRoot%\System32\OneDriveSetup.exe" /uninstall > nul
"%SystemRoot%\SysWOW64\OneDriveSetup.exe" /uninstall > nul

echo Removing remaining OneDrive folders.
xcopy /e "%UserProfile%\OneDrive" "%UserProfile%" > nul
rd /s /q "%UserProfile%\OneDrive" > nul
rd /s /q "%LocalAppData%\Microsoft\OneDrive" > nul
rd /s /q "%ProgramData%\Microsoft OneDrive" > nul
rd /s /q "C:\OneDriveTemp" > nul
del /s /f /q "%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\OneDrive.lnk" > nul

echo Removing OneDrive registry keys.
reg delete "HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f > nul
reg delete "HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f > nul
reg add "HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /v System.IsPinnedToNameSpaceTree /d "0" /t REG_DWORD /f > nul
reg delete "HKEY_USERS\DEFAULT\Software\Microsoft\Windows\CurrentVersion\Run" /v "OneDriveSetup" /f > nul

echo Deleting OneDrive Setup Files
echo Deleting OneDriveSetup.exe from SysWOW64...
takeown /f "%SystemRoot%\SysWOW64\OneDriveSetup.exe" > nul
icacls "%SystemRoot%\SysWOW64\OneDriveSetup.exe" /grant administrators:F > nul
del "%SystemRoot%\SysWOW64\OneDriveSetup.exe" /f > nul

echo Deleting OneDriveSetup.exe from System32...
takeown /f "%SystemRoot%\System32\OneDriveSetup.exe" > nul
icacls "%SystemRoot%\System32\OneDriveSetup.exe" /grant administrators:F > nul
del "%SystemRoot%\System32\OneDriveSetup.exe" /f > nul

echo Deleting it as a package
wget https://github.com/SteavenToolBox/Windows/raw/main/Scripts/install_wim_tweak.exe -O c:\install_wim_tweak.exe --no-check-certificate > nul
c:\install_wim_tweak.exe /o /c Microsoft-Windows-OneDrive > nul

pause
Author
Malnutrition
Views
289
First release
Last update

Ratings

0.00 star(s) 0 ratings

More resources from Malnutrition