Reset Users Homefolder Permissions

This batch file allows you to reset  permissions on re-directed folders. Download and install subinacl and adjust the batch as necessary. Insert relevant domain name on the first line.

 set domain-name=

for /f %%a in (‘cd’) do set currdir=%%a
for /f “tokens=*” %%a in (‘dir /b’) do call :updateit %%a
goto :eof

:updateit
c:subinaclsubinacl.exe /file %currdir%%1 /setowner=”%domain-name%%1″
c:subinaclsubinacl.exe /subdirectories %currdir%%1 /setowner=”%domain-name%%1″
c:subinaclsubinacl.exe /file %currdir%%1 /grant=”%domain-name%%1″=F
c:subinaclsubinacl.exe /subdirectories %currdir%%1 /grant”%domain-name%%1″=F
c:subinaclsubinacl.exe /file %currdir%%1 /grant=”Domain Admins”=F
c:subinaclsubinacl.exe /subdirectories %currdir%%1 /grant=”%domain-name%Domain Admins”=F
goto :eof