You are on page 1of 2

@echo off

title Resetting ACLs...


echo.
echo Determine whether we are on an 32 or 64 bit machine
echo.
if "%PROCESSOR_ARCHITECTURE%"=="x86" if "%PROCESSOR_ARCHITEW6432%"=="" goto x86
set ProgramFilesPath=%ProgramFiles(x86)%
goto startResetting
:x86
set ProgramFilesPath=%ProgramFiles%
:startResetting
echo.
cd /d "%ProgramFilesPath%\Windows Resource Kits\Tools"
echo.
echo Resetting ACLs...
echo (this may take several minutes to complete)
echo.
echo IMPORTANT NOTE: For this script to run correctly, you must change
echo the values named YOURUSERNAME to be the Windows user account that
echo you are logged in with.
echo.
echo ==========================================================================
echo.
echo.
subinacl /subkeyreg HKEY_CURRENT_USER /grant=administrators=f /grant=system=f /g
rant=restricted=r /grant=YOURUSERNAME=f /setowner=administrators > %temp%\subina
cl_output.txt
echo.
echo.
subinacl /keyreg HKEY_CURRENT_USER /grant=administrators=f /grant=system=f /gran
t=restricted=r /grant=YOURUSERNAME=f /setowner=administrators >> %temp%\subinacl
_output.txt
echo.
echo.
subinacl /subkeyreg HKEY_LOCAL_MACHINE /grant=administrators=f /grant=system=f /
grant=users=r /grant=everyone=r /grant=restricted=r /setowner=administrators >>
%temp%\subinacl_output.txt
echo.
echo.
subinacl /keyreg HKEY_LOCAL_MACHINE /grant=administrators=f /grant=system=f /gra
nt=users=r /grant=everyone=r /grant=restricted=r /setowner=administrators >> %te
mp%\subinacl_output.txt
echo.
echo.
subinacl /subkeyreg HKEY_CLASSES_ROOT /grant=administrators=f /grant=system=f /g
rant=users=r /setowner=administrators >> %temp%\subinacl_output.txt
echo.
echo.
subinacl /keyreg HKEY_CLASSES_ROOT /grant=administrators=f /grant=system=f /gran
t=users=r /setowner=administrators >> %temp%\subinacl_output.txt
echo.
echo.
echo System Drive...
subinacl /subdirectories %ProgramFilesPath%\ /grant=administrators=f /grant=syst
em=f /grant=users=e >> %temp%\subinacl_output.txt
echo.
echo.
echo Windows Directory...
subinacl /subdirectories %windir%\ /grant=administrators=f /grant=system=f /gran
t=users=e >> %temp%\subinacl_output.txt
echo.
echo.
echo ==========================================================================
echo.
echo FINISHED.
echo.
echo Press any key to exit . . .
pause >NUL