w10install/scripts/uninstall-onedrive.cmd
2023-02-08 16:12:23 +01:00

45 lines
1.5 KiB
Batchfile

@echo off
set OneDrive="%SYSTEMROOT%\SysWOW64\OneDriveSetup.exe"
echo ####### %0 #######
if NOT exist %OneDrive% (
echo OneDrive is NOT installed!
echo ####### %0 #######
exit /b
)
echo KILLING all OneDrive instances ...
taskkill /f /im OneDrive.exe > NUL 2>&1
echo UNINSTALLING OneDrive ...
%OneDrive% /uninstall
echo sleeping 5 seconds ...
ping 127.0.0.1 -n 5 > NUL 2>&1
echo CLEANUP OneDrive ...
rd "%USERPROFILE%\OneDrive" /Q /S > NUL 2>&1
rd "C:\OneDriveTemp" /Q /S > NUL 2>&1
rd "%LOCALAPPDATA%\Microsoft\OneDrive" /Q /S > NUL 2>&1
rd "%PROGRAMDATA%\Microsoft OneDrive" /Q /S > NUL 2>&1
echo removing OneDrive from explorer ...
reg delete "HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f > NUL 2>&1
reg delete "HKEY_CLASSES_ROOT\Wow6432Node\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
reg delete "HKEY_CURRENT_USER\Software\Classes\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}\ShellFolder" /f > NUL 2>&1
echo removing OneDrive update task ...
powershell -Command "Get-ScheduledTask | Where-Object {$_.Taskname -match 'OneDrive Standalone Update'} | Unregister-ScheduledTask -Confirm:$false"
echo KILLING all OneDrive SETUP instances ...
taskkill /f /im OneDriveSetup.exe > NUL 2>&1
echo removing OneDrive setup exe and dll ...
nsudo /U:T /P:E cmd.exe /C del /F /Q "%SYSTEMROOT%\SysWOW64\*onedrive*" 2>nul
echo ####### %0 #######