0

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

2 Answers 2

1

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
}
1
  • 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, 2011 at 18:21
0

@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

1
  • Thanks very much for the info, uSlackr. It was a tough call which answer to choose! Thank you.
    – Mark Major
    Jun 23, 2011 at 18:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .