Jump to content

Recommended Posts

Posted

Hi All,

 

I have a problem where some files in some home folders are losing their inherited permissions, it is affecting over 200 home folder. Basically I need a script/batch file that can take the permissions from the Root folder (which are all fine) and propagate them down, this would resolve the issues we are having.

 

I can do it individually and it resolves the issues however its a little impractical to do this 200 times, folder by folder.

 

Any one have a batch file or something that can do this? I have used iCacls in the past but I can't seem to get this to work this time.

 

Any help appreciated :)

Posted (edited)

This is the one I've used

@echo off

REM Create list of folders
dir /a:d /b "c:\Home Directories" >C:\users.txt

REM Read each line from just created text file...
for /f "tokens=*" %%G in (C:\users.txt) do (

takeown /f "c:\Home Directories\%%G" /r /d y
icacls "c:\Home Directories\%%G" /setowner "domain\%%G" /T /C /Q
icacls "c:\Home Directories\%%G" /T /C /Q /RESET

echo.
)

 

Takeown takes ownership

then you set the owner

and reset the permissions

Edited by nickbro
  • Thanks 1
  • 3 weeks later...
Posted
Any idea if this will work on server 2012. Just carried out a server upgrade from 2003 to 2012 and its randomly altered student home folders permissions and ownership. I used Robocopy for the transfer and previously it worked a treat from 2003 to 2008 but not this time.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...