pf100

Uninstaller_undo-all-script-changes-v2.7.3.cmd

Oct 29th, 2020
671
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.67 KB | None | 0 0
  1. @echo off
  2. mode con cols=85 lines=20
  3. Color 1F
  4. Title Sledgehammer 2.7.3 uninstaller
  5. ::Elevate permissions
  6. set "params=Problem_with_elevating_UAC_for_Administrator_Privileges"&if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs"
  7. fsutil dirty query %systemdrive% >nul 2>&1 && goto :GotPrivileges
  8. :: The following test is to avoid infinite looping if elevating UAC for Administrator Privileges failed
  9. If "%1"=="%params%" (echo Elevating UAC for Administrator Privileges failed&echo Right click on the script and select 'Run as administrator'&echo Press any key to exit...&pause>nul 2>&1&exit)
  10. cmd /u /c echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "%~0", "%params%", "", "runas", 1 > "%temp%\getadmin.vbs"&cscript //nologo "%temp%\getadmin.vbs"&exit
  11. :GotPrivileges
  12. ::Start
  13. cd /d "%~dp0"
  14. ::::::::::::::::::::::::::::::::::
  15. ::Determine if running 32 or 64 bit Windows OS and set variables accordingly.
  16. wmic cpu get AddressWidth /value|find "32">nul&&set PROCESSOR_ARCHITECTURE=X86||set PROCESSOR_ARCHITECTURE=AMD64
  17. if %PROCESSOR_ARCHITECTURE%==AMD64 (
  18. set "nsudovar=..\bin\NSudoCx64.exe"
  19. ) else (
  20. set "nsudovar=..\bin\NSudoc.exe"
  21. )
  22. ::::::::::::::::::::::::::::::::::
  23. echo. & echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ Sledgehammer Uninstaller
  24. echo. & echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ If you continue, and have no other method of controlling
  25. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ updates, UPDATES MAY START RIGHT AWAY.
  26. echo. & echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ DISABLE THE INTERNET FIRST? Press (Y)es or(N).
  27. echo. & echo ^ If you select (Y), "Network Connections" in the Control Panel will open so you can
  28. echo ^ temporarily disable your Internet connection.
  29. echo. & echo ^ Whether you select (Y) or (N), the next script window will stay open allowing you
  30. echo ^ to fully uninstall the script and all associated changes that were made when you
  31. echo ^ first ran the script.
  32. CHOICE /C YN /M "Your choice?:" >nul 2>&1
  33. if %errorlevel%==2 (goto nodisablenet)
  34. %systemroot%\System32\control.exe ncpa.cpl
  35. :nodisablenet
  36. cls
  37. echo. & echo. & echo. & echo. & echo. & echo. & echo.
  38. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ I have to ask if you're really sure?
  39. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ Press (Y)es to uninstall, (N)o or
  40. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ close window to cancel...
  41. CHOICE /C YN /M "Your choice?:" >nul 2>&1
  42. if %errorlevel%==2 (exit)
  43. cls
  44. set s32=%systemroot%\System32
  45. ::::::::::::::::::::::::::::::::::
  46. ::restore rempl folder permissions and delete rempl folder
  47. takeown /f "%ProgramFiles%\rempl" /a >nul 2>&1
  48. icacls "%ProgramFiles%\rempl" /reset >nul 2>&1
  49. ::restore rempl file permissions
  50. for %%? in ("%ProgramFiles%\rempl\*") do (
  51. takeown /f "%%?" /a >nul 2>&1
  52. icacls "%%?" /q /c /reset >nul 2>&1
  53. rem icacls "%%?" /setowner *S-1-5-18 >nul 2>&1
  54. )
  55. del "%ProgramFiles%\rempl\*.*" /f /q >nul 2>&1
  56. rmdir "%ProgramFiles%\rempl" /s /q >nul 2>&1
  57. ::::::::::::::::::::::::::::
  58. schtasks /delete /tn WDU >nul /f 2>&1
  59. schtasks /delete /tn Wub_task /f >nul 2>&1
  60. schtasks /Delete /Tn \Microsoft\WuWrapperScript\WDU /f >nul 2>&1
  61. schtasks /Delete /Tn \Microsoft\WuWrapperScript\Wub_task /f >nul 2>&1
  62. rmdir %SystemDrive%\Windows\System32\Tasks\Microsoft\WuWrapperScript /s /q >nul 2>&1
  63. rem timeout /t 3 >nul 2>&1
  64. %nsudovar% -ShowWindowMode:Hide -Wait -U:T -P:E reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\WuWrapperScript" /f >nul 2>&1
  65. schtasks /Delete /Tn \Microsoft\Sledgehammer\WDU /f >nul 2>&1
  66. schtasks /Delete /Tn \Microsoft\Sledgehammer\Wub_task /f >nul 2>&1
  67. schtasks /Delete /Tn \Microsoft\Sledgehammer\LockFiles /f >nul 2>&1
  68. rmdir %SystemDrive%\Windows\System32\Tasks\Microsoft\Sledgehammer /s /q >nul 2>&1
  69. rem timeout /t 3 >nul 2>&1
  70. %nsudovar% -ShowWindowMode:Hide -Wait -U:T -P:E reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Sledgehammer" /f >nul 2>&1
  71. ::::::::::::::::::::::::::::::::::
  72. ::Restore Language Components Installer tasks to defaults
  73. takeown /f "%systemroot%\System32\Tasks\Microsoft\Windows\LanguageComponentsInstaller\*" /a >nul 2>&1
  74. icacls "%systemroot%\System32\Tasks\Microsoft\Windows\LanguageComponentsInstaller\*" /q /c /t /reset >nul 2>&1
  75. for %%? in ("%systemroot%\System32\Tasks\Microsoft\Windows\LanguageComponentsInstaller\*") do schtasks /change /tn "Microsoft\Windows\LanguageComponentsInstaller\%%~nx?" /enable >nul 2>&1
  76. schtasks /change /tn "Microsoft\Windows\LanguageComponentsInstaller\Uninstallation" /disable >nul 2>&1
  77. icacls "%systemroot%\System32\Tasks\Microsoft\Windows\LanguageComponentsInstaller\*" /setowner *S-1-5-18 >nul 2>&1
  78. ::::::::::::::::::::::::::::::::::
  79. ::Restore Windows Update tasks to defaults
  80. takeown /f "%systemroot%\System32\Tasks\Microsoft\Windows\WindowsUpdate\*" /a >nul 2>&1
  81. icacls "%systemroot%\System32\Tasks\Microsoft\Windows\WindowsUpdate\*" /q /c /t /reset >nul 2>&1
  82. for %%? in ("%systemroot%\System32\Tasks\Microsoft\Windows\WindowsUpdate\*") do schtasks /change /tn "Microsoft\Windows\WindowsUpdate\%%~nx?" /enable >nul 2>&1
  83. icacls "%systemroot%\System32\Tasks\Microsoft\Windows\WindowsUpdate\*" /setowner *S-1-5-18 >nul 2>&1
  84. ::::::::::::::::::::::::::::::::::
  85. ::Restore default permissions to Update Hijacker files disabled by script
  86. set s32list=EOSNotify.exe WaaSMedic.exe WaasMedicSvc.dll WaaSMedicPS.dll WaaSAssessment.dll UsoClient.exe
  87. set s32list=%s32list% SIHClient.exe MusNotificationUx.exe MusNotification.exe osrss.dll
  88. ::If "s32list" files were renamed by script, restore original file names
  89. for %%# in (%s32list%) do (
  90. ren "%s32%\%%#"-backup "%%#" >nul 2>&1
  91. if exist "%s32%\%%#" del "%s32%\%%#"-backup /f /q >nul 2>&1
  92. )
  93. ::Now restore default permissions for Update Hijacker files
  94. for %%# in (%s32list%) do (
  95. takeown /f "%s32%\%%#" /a >nul 2>&1
  96. icacls "%s32%\%%#" /reset >nul 2>&1
  97. icacls "%s32%\%%#" /setowner *S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464 >nul 2>&1
  98. )
  99. ::restore Update Assistant folder permissions, then delete
  100. takeown /f "%systemroot%\UpdateAssistant" /a >nul 2>&1
  101. icacls "%systemroot%\UpdateAssistant" /reset >nul 2>&1
  102. icacls "%systemroot%\UpdateAssistant" /setowner *S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464 >nul 2>&1
  103. del %systemroot%\UpdateAssistant\*.* /f /q >nul 2>&1
  104. rmdir %systemroot%\UpdateAssistant /s /q >nul 2>&1
  105. takeown /f "%systemroot%\UpdateAssistantV2" /a >nul 2>&1
  106. icacls "%systemroot%\UpdateAssistantV2" /reset >nul 2>&1
  107. icacls "%systemroot%\UpdateAssistantV2" /setowner *S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464 >nul 2>&1
  108. del %systemroot%\UpdateAssistantV2\*.* /f /q >nul 2>&1
  109. rmdir %systemroot%\UpdateAssistantV2 /s /q >nul 2>&1
  110. takeown /f "%systemdrive%\Windows10Upgrade" /a >nul 2>&1
  111. icacls "%systemdrive%\Windows10Upgrade" /reset >nul 2>&1
  112. icacls "%systemdrive%\Windows10Upgrade" /setowner *S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464 >nul 2>&1
  113. del %SystemDrive%\Windows10Upgrade\*.* /f /q >nul 2>&1
  114. rmdir %SystemDrive%\Windows10Upgrade /s /q >nul 2>&1
  115. ::::::::::::::::::::::::::::::::::
  116. ..\bin\wub.exe /e >nul 2>&1
  117. timeout /t 3 >nul 2>&1
  118. reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer /v SettingsPageVisibility /f >nul 2>&1
  119. cls
  120. if not exist unins000.exe (
  121. echo. & echo. & echo. & echo. & echo. & echo.
  122. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ::::::::::::::::::::::::::::::::::::
  123. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ : Sledgehammer uninstalled. :
  124. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ : Press any key to exit... :
  125. echo ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ::::::::::::::::::::::::::::::::::::
  126. pause > nul
  127. exit
  128. )
  129. rem unins000.exe /silent /norestart
Add Comment
Please, Sign In to add comment