w10install/scripts/uninstall-onedrive.cmd

45 lines
1.5 KiB
Batchfile
Raw Permalink Normal View History

2021-01-10 18:45:55 +01:00
@echo off
2022-12-26 19:04:35 +01:00
set OneDrive="%SYSTEMROOT%\SysWOW64\OneDriveSetup.exe"
2021-01-10 18:45:55 +01:00
echo ####### %0 #######
2022-12-26 19:04:35 +01:00
if NOT exist %OneDrive% (
echo OneDrive is NOT installed!
echo ####### %0 #######
exit /b
)
2021-03-22 00:39:55 +01:00
2022-12-26 19:04:35 +01:00
echo KILLING all OneDrive instances ...
taskkill /f /im OneDrive.exe > NUL 2>&1
2021-01-10 18:45:55 +01:00
echo UNINSTALLING OneDrive ...
2022-12-26 19:04:35 +01:00
%OneDrive% /uninstall
2021-03-22 00:39:55 +01:00
2023-01-22 21:18:28 +01:00
echo sleeping 5 seconds ...
2021-01-10 18:45:55 +01:00
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
2022-12-26 19:04:35 +01:00
echo removing OneDrive from explorer ...
2022-12-26 21:40:25 +01:00
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
2021-01-10 18:45:55 +01:00
2022-12-26 19:04:35 +01:00
echo removing OneDrive update task ...
2021-05-26 23:26:16 +02:00
powershell -Command "Get-ScheduledTask | Where-Object {$_.Taskname -match 'OneDrive Standalone Update'} | Unregister-ScheduledTask -Confirm:$false"
2021-05-26 22:47:13 +02:00
2022-12-26 19:04:35 +01:00
echo KILLING all OneDrive SETUP instances ...
taskkill /f /im OneDriveSetup.exe > NUL 2>&1
2023-01-22 15:20:08 +01:00
echo removing OneDrive setup exe and dll ...
2024-07-18 14:18:49 +02:00
superuser /sw cmd.exe /C del /F /Q "%SYSTEMROOT%\SysWOW64\*onedrive*" 2>nul
2022-12-26 19:04:35 +01:00
2021-01-10 18:45:55 +01:00
echo ####### %0 #######