Files
automated_rammap.bat/automated_rammap.bat
T
2026-09-16 17:57:40 +00:00

73 lines
1.8 KiB
Batchfile

:: USAGE
:: DOWNLOAD SCRIPT
:: RIGHT CLICK AND RUN AS ADMIN ON USER'S MACHINE
:: THIS WILL AUTOMATICALLY RUN RAMMAP, AND THEN CREATE A SCHEDULED TASK TO DO THE SAME EVERY HALF AN HOUR
@echo off
color 0A
echo installing rammap automated cleanup...
:: set variables
set INSTALLDIR=C:\ProgramData\RAMMap
set RAMMAP=%INSTALLDIR%\RAMMap64.exe
set SCRIPT=%INSTALLDIR%\automated_rammap.bat
set LOGFILE=%INSTALLDIR%\RAMMap.log
:: create rammap directory
mkdir "%INSTALLDIR%"
:: download rammap
echo downloading rammap...
curl -L -o "%TEMP%\RAMMap.zip" https://download.sysinternals.com/files/RAMMap.zip
:: extract rammap
echo extracting...
::powershell -command "Expand-Archive -Force '%TEMP%\RAMMap.zip' '%INSTALLDIR%'"
tar -xvf "%TEMP%\RAMMap.zip" -C "%INSTALLDIR%"
:: accept eula
echo accept the EULA...
"%RAMMAP%" -EulaAccepted
:: create automated cleanup script batch file
echo creating automated cleanup script...
(
echo @echo off
echo set RAMMAP=%RAMMAP%
echo set LOGFILE=%LOGFILE%
echo echo %%time%% %%date%% starting RAMMap cleanup ^>^> "%LOGFILE%"
echo %RAMMAP% -accepteula -Ew
echo %RAMMAP% -accepteula -Es
echo %RAMMAP% -accepteula -Em
echo %RAMMAP% -accepteula -Et
echo %RAMMAP% -accepteula -E0
echo echo Finished RAMMap cleanup at %%time%% %%date%% ^>^> "%LOGFILE%"
echo exit /b 0
) > "%SCRIPT%"
:: create the scheduled task
echo creating scheduled task...
schtasks /create ^
/tn "RAMMap Automated Cleanup" ^
/tr "%SCRIPT%" ^
/sc minute ^
/mo 30 ^
/ru SYSTEM
:: cleanup rammap zip file
del "%TEMP%\RAMMap.zip"
:: run task manually (so you do not have to wait half an hour to see the effect)
schtasks /run /tn "RAMMap Automated Cleanup"
echo .
echo rammap cleanup deployed successfully
echo this has created a scheduled task which runs rammap every 30 minutes as system
echo now you wont have to manually do it \(^^_^^)/
pause
exit 0