New
#1
Uninstall OneDrive.
I performed aTest Install
a few days ago to get ready for aClean Install
in a couple of days, BUT, I must admit that I was lazy, and in order toUninstall OneDrive
, I only ran . . .
Code:taskkill /f /im OneDrive.exe C:\Windows\SysWOW64\OneDriveSetup.exe /uninstall -ErrorAction SilentlyContinue
Bearing that in mind, I have put the following Batch Script together [ with info where needed ] ready to use on my actualClean Install
. Unfortunately, I canNOT
test it. Maybe someone could look at it please and tell me if I have excluded anything important, or included anything that isNOT
required.
Code:@echo off setlocal EnableDelayedExpansion set "params=%*" cd /d "%~dp0" && ( if exist "%Temp%\getadmin.vbs" del "%Temp%\getadmin.vbs") && fsutil dirty query %systemdrive% 1>nul 2>nul || ( echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "cmd.exe", "/k cd ""%~sdp0"" && %~s0 %params%", "", "runas", 1 >> "%Temp%\getadmin.vbs" && "%Temp%\getadmin.vbs" && Exit /b) %windir%\system32\reg.exe query "HKU\S-1-5-19" 1>nul 2>nul || ( echo. & echo ERROR: This Batch file MUST be run in an ELEVATED cmd prompt [ Administrator ] & echo. & echo Right-click the Batch file and click ^<Run as Administrator^>. & echo. & echo ^>Press ANY key to EXIT . . . & pause >nul & Exit ) set x86="%SystemRoot%\System32\OneDriveSetup.exe" set x64="%SystemRoot%\SysWOW64\OneDriveSetup.exe" echo. & echo Processing [ Uninstalling OneDrive ] . . . taskkill /f /im OneDrive.exe >nul 2>&1 ping 127.0.0.1 -n 5 >nul 2>&1 if exist %x64% ( %x64% /uninstall ) else ( %x86% /uninstall ) ping 127.0.0.1 -n 8 >nul 2>&1 :: >>> Uninstall OneDrive <<< rmdir "%UserProfile%\OneDrive" /q /s >nul 2>&1 rmdir "C:\OneDriveTemp" /q /s >nul 2>&1 rmdir "%LocalAppData%\Microsoft\OneDrive" /q /s >nul 2>&1 rmdir "%ProgramData%\Microsoft OneDrive" /q /s >nul 2>&1 :: >>> Remove OneDrive from Win Explorer [ Left-Hand Side Panel ] <<< :: This belongs to OneDrive reg delete "HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f >nul 2>&1 reg delete "HKEY_CURRENT_USER\Software\Classes\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}\ShellFolder" /f >nul 2>&1 :: This belongs to Win 10 reg delete "HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f >nul 2>&1 reg delete "HKEY_CURRENT_USER\Software\Classes\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}\ShellFolder" /f >nul 2>&1 echo Processing Complete. echo. & echo ^>Press ANY key to EXIT . . . & pause >nul & Exit
[1] I am pretty sure that this will survive aReboot
, but obviously I canNOT
test it.
[2] This should also remove OneDrive from the right-click File Explorer dropdown menu onThis PC
for example.
Thanks in advance.