We help IT Professionals succeed at work.

Edit folder permissions

jering
jering asked
on
271 Views
Last Modified: 2010-04-18
Scenario:
A folder E:\users contains the homedirectories for many users which is
copied from an old domain.
The need is to edit the permissions on all folder so the users and
administrator got full access. The names of the folders are the same as the
usernames.

Is this possible by using VBScript?
Are there any examplescripts?
Comment
Watch Question

ikm7176Sr. IT Manager
CERTIFIED EXPERT

Commented:
Xcalcs.exe or xcacls.vbs is a good utility for this:

http://support.microsoft.com/?id=825751

http://support.microsoft.com/default.aspx?scid=kb;en-us;Q318754



Xcacls.exe Syntax
xcacls file name [/T] [/E] [/C] [/G user:perm;spec] [/R user] [/P user:perm;spec [...]] [/D user [...]] [/Y]
where file name indicates the name of the file or folder to which the ACL or access control entry (ACE) is typically applied. All standard wildcard characters can be used.

/T recursively walks through the current folder and all of its subfolders, applying the chosen access rights to the matching files or folders.

/E edits the ACL instead of replacing it. For example, only the administrator will have access to the Test.dat file if you run the XCACLS test.dat /G Administrator:F command. All ACEs applied earlier are lost.

/C causes Xcacls.exe to continue if an "access denied" error message occurs. If /C is not specified, Xcacls.exe stops on this error.

/G user:perm;spec grants a user access to the matching file or folder.

You want to include the /E (for EDIT instead of replace permissions)


i.e.

Type XCACLS *.* /G administrator:RW /E at the command prompt, and then press ENTER to edit the ACL of all files and folders in the current folder without scanning subfolders .

So, you can also put this in a Bat file...

Start --> Run --> Notepad

XCACLS D:\data\allusers\*.* /G administrator:RW /E
XCACLS F:\data\businessdata\*.* /G administrator:RW /E
XCACLS G:\backup\*.* /G administrator:RW /E

Save as copystuff.bat

Then run copystuff.bat to kick off the copies...

-later

Author

Commented:
Thanks for the answers.

But maybe I declared my question a bit unclear:

Folder: E:\Users

Contains these subfolders:
user1
user2
user3
user4
user5
and so on...

XCACLS gives administrator the correct permissions by:
XCACLS E:\Users\*.* /G administrator:RW /E

But also, the user should have Full control. So the permissions for folder E:\Users\user1 would be:
Adminstrator - Full control
User1 - Full control

For folder E:\Users\user2:
Adminstrator - Full control
User2 - Full control

And so on...

Can this be done?
CERTIFIED EXPERT
Most Valuable Expert 2019
Most Valuable Expert 2018
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.