Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a folder structure similar to the one shown below these paragraphs. How do I change security on every 'Photos' folder without clicking through each individually in Windows Explorer? There are about 50 top level folders (Bob, Jim, Eva, etc, etc) which have the same layout of folders inside.

I am keen for any suggestions, either scripting or GUI. I am on Windows Server 2003. Cheap/free method would be good, as the company is part of a registered charity. Ideally I would like to do this via DFS path. E.G. \\mycompany.local\Shared\Staff\Bob\

Thanks for reading. Thanks for any info. Mark

  • Bob
    • Review
    • Profile
      • Photos
  • Jim
    • Review
    • Profile
      • Photos
  • Eva
    • Review
    • Profile
      • Photos
share|improve this question

2 Answers 2

up vote 1 down vote accepted

The following little PowerShell script could do the trick for you. It would start in the root of the c drive and recurse through finding all the directories named Photos.

Then the correctacl variable gets the permissions you want to apply from an existing folder. (I assume you could also set up your own ACL object but that would be more difficult it seems.)

Finally, for each folder found it sets the ACL to match the ACL in correctacl. Might take a while depending on the size of the server, but should work.

$folders = Get-ChildItem -Path "\\someserver\c$" -Filter "Photos" -Recurse|Where-Object { $_.PSIsContainer }
$correctacl=Get-Acl -Path "\\someserver\c$\somefoldertogetaclobjectfrom"
foreach ($folder in $folders)
{
Set-Acl -AclObject $correctacl -Path $folder.PSPath
}
share|improve this answer
    
Thanks, Christopher. This looks very promising. I had not heard of an 'ACL object' and that sounds like a useful thing too. Thank you. –  Mark Major Jun 23 '11 at 18:21

@Christopher's powershell method will work. If you are more comfortable with the legacy comand line try this

For /D %i in (*) do cacls %i\profile\Photos .......

Run cacls ? at the command line to figure out the remainder of the command for your settings

The for /d will match against directories of the pattern "*" (so everything) so you'll run this from the top level of the directory structure.

Note - you might change the patterns to " bo *" to restrict the match set for testing

share|improve this answer
    
Thanks very much for the info, uSlackr. It was a tough call which answer to choose! Thank you. –  Mark Major Jun 23 '11 at 18:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.