Uninstall OneDrive.


  1. Posts : 15,982
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #1

    Uninstall OneDrive.


    I performed a Test Install a few days ago to get ready for a Clean Install in a couple of days, BUT, I must admit that I was lazy, and in order to Uninstall 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 actual Clean Install. Unfortunately, I can NOT test it. Maybe someone could look at it please and tell me if I have excluded anything important, or included anything that is NOT 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 a Reboot, but obviously I can NOT test it.
    [2] This should also remove OneDrive from the right-click File Explorer dropdown menu on This PC for example.

    Thanks in advance.
      My Computer


  2. Posts : 7,451
    Windows 10 Home 20H2
       #2

    Paul Black said:
    Code:
    taskkill /f /im OneDrive.exe
    I find WMIC stronger than Taskkill

    WMIC process where name='OneDrive.exe' Delete

    I have not uninstalled OneDrive, though.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 22:58.
Find Us




Windows 10 Forums