SHARE
TWEET

Untitled

a guest Nov 15th, 2017 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. REM Change folderpath
  3. set folderpath=\\domain.local\files\scripts\autoclean
  4.  
  5. if exist "%programfiles%\op5\NSClient++\nsc.log" del "%programfiles%\op5\NSClient++\nsc.log"
  6. if exist "%programfiles%\NSClient++\nsc.log" del "%programfiles%\NSClient++\nsc.log"
  7. if exist "%programdata%\Adobe\Arm" rmdir /q /s %programdata%\Adobe\Arm
  8. if exist "%windir%\System32\config\systemprofile\AppData\Local\nsclient++\process_info.csv" del "%windir%\System32\config\systemprofile\AppData\Local\nsclient++\process_info.csv"
  9. if exist "%programdata%\Veeam\Backup" del /q /f "%programdata%\Veeam\Backup\*"
  10.  
  11. FOR /F "USEBACKQ tokens=*" %%F IN (`dir /b /a:d /s "C:\$Recycle.Bin\" ^| FIND /i "C:\$Recycle.Bin\"`) DO (
  12.  rmdir /q /s "%%F"
  13. )
  14.  
  15. regedit /s %folderpath%\cleanmgr.reg
  16.  
  17. if exist %windir%\system32\cleanmgr.exe (
  18. set CLEANMGREXE=system32
  19. goto system32)
  20.  
  21. if exist %windir%\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_c9392808773cd7da\cleanmgr.exe (
  22. set CLEANMGREXE=amd64
  23. goto amd64)
  24.  
  25. if exist %windir%\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.0.6001.18000_none_c962d1e515e94269\cleanmgr.exe (
  26. set CLEANMGREXE=amd64_2008
  27. goto amd64_2008)
  28.  
  29. if exist %windir%\winsxs\x86_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_6d1a8c84bedf66a4\cleanmgr.exe (
  30. set CLEANMGREXE=x86
  31. goto x86)
  32.  
  33. if exist %windir%\winsxs\x86_microsoft-windows-cleanmgr_31bf3856ad364e35_6.0.6001.18000_none_6d4436615d8bd133\cleanmgr.exe (
  34. set CLEANMGREXE=x86_2008
  35. goto x86_2008)
  36.  
  37. if exist %windir%\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.2.9200.16384_none_c60dddc5e750072a\cleanmgr.exe (
  38. set CLEANMGREXE=amd64_2012
  39. goto amd64_2012)
  40.  
  41. FOR /F "USEBACKQ tokens=*" %%F IN (`wmic os get version ^| find /i "6.3.9600"`) DO (
  42.  if %%F GTR 6.2.9999 (
  43. set OSLVL=%%F
  44. )
  45. )
  46. IF %OSLVL% LSS 6.3.9999 (
  47. copy /Y %folderpath%\2012r2\cleanmgr.exe %windir%\system32\cleanmgr.exe
  48. copy /Y %folderpath%\2012r2\cleanmgr.exe.mui %windir%\system32\en-US\cleanmgr.exe.mui
  49. goto system32
  50. )
  51. echo EXE not found
  52. goto:eof
  53.  
  54. :system32
  55. echo SET=%CLEANMGREXE%
  56. %windir%\system32\cleanmgr.exe /sagerun:5
  57. goto:eof
  58.  
  59. :amd64
  60. echo SET=%CLEANMGREXE%
  61. copy /Y %windir%\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.1.7600.16385_en-us_b9cb6194b257cc63\cleanmgr.exe.mui c:\windows\system32\en-US\cleanmgr.exe.mui
  62. copy /Y %windir%\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_c9392808773cd7da\cleanmgr.exe c:\windows\system32\cleanmgr.exe
  63. %windir%\system32\cleanmgr.exe /sagerun:5
  64.  
  65. goto:eof
  66.  
  67. :x86
  68. echo SET=%CLEANMGREXE%
  69. copy /Y %windir%\winsxs\x86_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.1.7600.16385_en-us_b9cb6194b257cc63\cleanmgr.exe.mui c:\windows\system32\en-US\cleanmgr.exe.mui
  70. copy /Y %windir%\winsxs\x86_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_c9392808773cd7da\cleanmgr.exe c:\windows\system32\cleanmgr.exe
  71. %windir%\system32\cleanmgr.exe /sagerun:5
  72.  
  73. goto:eof
  74.  
  75. :amd64_2008
  76. echo SET=%CLEANMGREXE%
  77. copy /Y %windir%\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.0.6001.18000_en-us_b9f50b71510436f2\cleanmgr.exe.mui c:\windows\system32\en-US\cleanmgr.exe.mui
  78. copy /Y %windir%\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.0.6001.18000_none_c962d1e515e94269\cleanmgr.exe c:\windows\system32\cleanmgr.exe
  79. %windir%\system32\cleanmgr.exe /sagerun:5
  80.  
  81. goto:eof
  82.  
  83. :x86_2008
  84. echo SET=%CLEANMGREXE%
  85. copy /Y %windir%\winsxs\x86_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.0.6001.18000_en-us_5dd66fed98a6c5bc\cleanmgr.exe.mui c:\windows\system32\en-US\cleanmgr.exe.mui
  86. copy /Y %windir%\winsxs\x86_microsoft-windows-cleanmgr_31bf3856ad364e35_6.0.6001.18000_none_6d4436615d8bd133\cleanmgr.exe c:\windows\system32\cleanmgr.exe
  87. %windir%\system32\cleanmgr.exe /sagerun:5
  88.  
  89. goto:eof
  90.  
  91. :amd64_2012
  92. echo SET=%CLEANMGREXE%
  93. copy /Y %windir%\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.2.9200.16384_en-us_b6a01752226afbb3\cleanmgr.exe.mui c:\windows\system32\en-US\cleanmgr.exe.mui
  94. copy /Y %windir%\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.2.9200.16384_none_c60dddc5e750072a\cleanmgr.exe c:\windows\system32\cleanmgr.exe
  95. %windir%\system32\cleanmgr.exe /sagerun:5
  96.  
  97. goto:eof
RAW Paste Data
Top