Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- REM Change folderpath
- set folderpath=\\domain.local\files\scripts\autoclean
- if exist "%programfiles%\op5\NSClient++\nsc.log" del "%programfiles%\op5\NSClient++\nsc.log"
- if exist "%programfiles%\NSClient++\nsc.log" del "%programfiles%\NSClient++\nsc.log"
- if exist "%programdata%\Adobe\Arm" rmdir /q /s %programdata%\Adobe\Arm
- if exist "%windir%\System32\config\systemprofile\AppData\Local\nsclient++\process_info.csv" del "%windir%\System32\config\systemprofile\AppData\Local\nsclient++\process_info.csv"
- if exist "%programdata%\Veeam\Backup" del /q /f "%programdata%\Veeam\Backup\*"
- FOR /F "USEBACKQ tokens=*" %%F IN (`dir /b /a:d /s "C:\$Recycle.Bin\" ^| FIND /i "C:\$Recycle.Bin\"`) DO (
- rmdir /q /s "%%F"
- )
- regedit /s %folderpath%\cleanmgr.reg
- if exist %windir%\system32\cleanmgr.exe (
- set CLEANMGREXE=system32
- goto system32)
- if exist %windir%\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_c9392808773cd7da\cleanmgr.exe (
- set CLEANMGREXE=amd64
- goto amd64)
- if exist %windir%\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.0.6001.18000_none_c962d1e515e94269\cleanmgr.exe (
- set CLEANMGREXE=amd64_2008
- goto amd64_2008)
- if exist %windir%\winsxs\x86_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_6d1a8c84bedf66a4\cleanmgr.exe (
- set CLEANMGREXE=x86
- goto x86)
- if exist %windir%\winsxs\x86_microsoft-windows-cleanmgr_31bf3856ad364e35_6.0.6001.18000_none_6d4436615d8bd133\cleanmgr.exe (
- set CLEANMGREXE=x86_2008
- goto x86_2008)
- if exist %windir%\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.2.9200.16384_none_c60dddc5e750072a\cleanmgr.exe (
- set CLEANMGREXE=amd64_2012
- goto amd64_2012)
- FOR /F "USEBACKQ tokens=*" %%F IN (`wmic os get version ^| find /i "6.3.9600"`) DO (
- if %%F GTR 6.2.9999 (
- set OSLVL=%%F
- )
- )
- IF %OSLVL% LSS 6.3.9999 (
- copy /Y %folderpath%\2012r2\cleanmgr.exe %windir%\system32\cleanmgr.exe
- copy /Y %folderpath%\2012r2\cleanmgr.exe.mui %windir%\system32\en-US\cleanmgr.exe.mui
- goto system32
- )
- echo EXE not found
- goto:eof
- :system32
- echo SET=%CLEANMGREXE%
- %windir%\system32\cleanmgr.exe /sagerun:5
- goto:eof
- :amd64
- echo SET=%CLEANMGREXE%
- 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
- copy /Y %windir%\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_c9392808773cd7da\cleanmgr.exe c:\windows\system32\cleanmgr.exe
- %windir%\system32\cleanmgr.exe /sagerun:5
- goto:eof
- :x86
- echo SET=%CLEANMGREXE%
- 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
- copy /Y %windir%\winsxs\x86_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_c9392808773cd7da\cleanmgr.exe c:\windows\system32\cleanmgr.exe
- %windir%\system32\cleanmgr.exe /sagerun:5
- goto:eof
- :amd64_2008
- echo SET=%CLEANMGREXE%
- 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
- copy /Y %windir%\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.0.6001.18000_none_c962d1e515e94269\cleanmgr.exe c:\windows\system32\cleanmgr.exe
- %windir%\system32\cleanmgr.exe /sagerun:5
- goto:eof
- :x86_2008
- echo SET=%CLEANMGREXE%
- 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
- copy /Y %windir%\winsxs\x86_microsoft-windows-cleanmgr_31bf3856ad364e35_6.0.6001.18000_none_6d4436615d8bd133\cleanmgr.exe c:\windows\system32\cleanmgr.exe
- %windir%\system32\cleanmgr.exe /sagerun:5
- goto:eof
- :amd64_2012
- echo SET=%CLEANMGREXE%
- 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
- copy /Y %windir%\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.2.9200.16384_none_c60dddc5e750072a\cleanmgr.exe c:\windows\system32\cleanmgr.exe
- %windir%\system32\cleanmgr.exe /sagerun:5
- goto:eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement