Skip to content

Instantly share code, notes, and snippets.

@amercier
Created August 30, 2017 10:36
Show Gist options
  • Save amercier/0a437c9c2f235f1eb872f84c63481e4a to your computer and use it in GitHub Desktop.
Save amercier/0a437c9c2f235f1eb872f84c63481e4a to your computer and use it in GitHub Desktop.
Uninstall OneDrive from Windows 10
@echo OFF
net session >nul 2>&1
if %ERRORLEVEL% equ 0 (
echo [OK] Administrator PRIVILEGES Detected!
echo.
) else (
echo ######## ######## ######## ####### ########
echo ## ## ## ## ## ## ## ## ##
echo ## ## ## ## ## ## ## ## ##
echo ###### ######## ######## ## ## ########
echo ## ## ## ## ## ## ## ## ##
echo ## ## ## ## ## ## ## ## ##
echo ######## ## ## ## ## ####### ## ##
echo.
echo.
echo ####### ERROR: ADMINISTRATOR PRIVILEGES REQUIRED #########
echo This script must be run as administrator to work properly!
echo ##########################################################
echo.
pause
exit /B 1
)
taskkill /f /im OneDrive.exe
echo [OK] OneDrive task killed
echo.
%SystemRoot%\SysWOW64\OneDriveSetup.exe /uninstall
echo [OK] OneDrive uninstalled
echo.
reg add HKCR\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6} /f /v System.IsPinnedToNameSpaceTree /t REG_DWORD /d 0
echo [OK] OneDrive shortcut removed from explorer
echo.
echo ##########################################################
echo OneDrive uninstalled successfully!
echo ##########################################################
echo .
pause
@echo ON
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment