Apparently it can be done in a bat file that accesses Cacls. Just figured that out
http://ss64.com/nt/cacls.htmlNow how would one write such a batch file. I got this off the web but it might as well be in Chinese:
@echo off
set zLog=ResetHomePerms.log
cls
echo FIXHOME.BAT
echo This script will reset permissions for all subdirectories
echo in this folder. It is assumed that the subdirectories
echo are named the same as their respective username.
echo.
choice /C YN /M “Are you sure you want to proceed?”
if errorlevel 2 GOTO :Exit
if errorlevel 1 GOTO :MAIN
:MAIN
if exist %zLog% del %zlog% >NUL
choice /C CF /M “Do you want users to have (C)hange or (F)ull control permissions?”
if errorlevel 2 GOTO ResetF
if errorlevel 1 GOTO ResetC
:RESETF
echo Granting users FULL permissions
echo.
echo Granting users FULL permissions >>%zlog%
for /f %%i in (‘dir /b /ad’) do @echo %%i >>%zLog% && echo y|cacls %%i /T /g Administrators:F >NUL && cacls %%i /T /e /g %userdomain%\%%i:F >>%zLog% && echo **********>>%Zlog%
REM rem out or modify the following line if you do not want to give Domain Admins Full control
for /f %%i in (‘dir /b /ad’) do @echo %%i >>%zLog% && cacls %%i /T /e /g “%userdomain%\Domain Admins”:F >>%zLog% && echo **********>>%Zlog%
goto :CLOSE
:RESETC
echo Granting users CHANGE permissions
echo.
echo Granting users CHANGE permissions >>%zlog%
for /f %%i in (‘dir /b /ad’) do @echo %%i >>%zLog% && echo y|cacls %%i /T /g Administrators:F >NUL && cacls %%i /T /e /g %userdomain%\%%i:C >>%zLog% && echo **********>>%Zlog%
REM rem out or modify the following line if you do not want to give Domain Admins Full control
for /f %%i in (‘dir /b /ad’) do @echo %%i >>%zLog% && cacls %%i /T /e /g “%userdomain%\Domain Admins”:F >>%zLog% && echo **********>>%Zlog%
goto :CLOSE
:CLOSE
echo. >>%zLog%
date /t >>%zlog% && time /t >>%zLog%
echo.
echo See %zlog% for details
set zLog=
set zLogError=
:EXIT
echo Exiting script
If you don't sin, Jesus died for nothing.