Jump to content

Recommended Posts

Posted

Hi,

I've come in this morning and realised that some changes i made over the holiday haven't worked quite as i hoped. I now need a way to take ownership of files and folders, then set them to inherit their permissions from above.

I've figured out how to take ownership with the takeown command, but can't find a way to set the inherit permissions setting on them without doing it manually! Is there a command i can run that will set this? I really don't want to have to do it manually!?!

 

I will need to script this so that it does it for every user, but only certain folders are affected.... (Application Data, Desktop)

 

Anyone know how i can do this?

Thanks

Posted (edited)

I figured it out :D:bounce:

I used

takeown /F * /R

to take ownership of the folders/files

then

xcacls.vbs "Application Data" /I Enable /T

to set the inherit setting.

 

@echo off
for /F %%g IN (test.txt) DO (
cd %%g\
@echo Doing %%g
takeown /F * /R
@echo Owned %%g
xcacls.vbs "Application Data" /I Enable /T /F
@echo Done %%g
cd ..)

test.txt contained all the staff usernames, and it was the Application Data folder that needed modifying.

It also echoes the progress at various stages.

 

It's probably not perfect but it worked :)

Edited by bmdixon
missed option from xcacls

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...