powershell - How to set acl permissions for specific sub-folders in many paths? -


here example folder path: e:\datastore\marcstone bids\7401-7450\7415 building renovation , addition van meter community school district - van meter ia\bid documents

note how second last directory job #/name. have hundreds of these paths on windows 2008 r2 server. inside each 1 exists exact same group of 10 folders created script. inherit parent permissions fine, except 3 of 10 folders require single additional acl permission. want add additional permission through script of kind. i've looked @ vbscript, seems wildcards in folder paths complication better handled powershell, i'm not sure.

so, appreciate counsel on choosing method perform action , more importantly build working script.

thoughts??

your simple answer lays in command line tools.

type icacls /? , for /?

using dir command can give list of folders matching.

dir *partialfoldername* /ad /s /b 

putting for loop.

for /f %a in ('dir *partialfoldername* /ad /s /b) icacls %a /grant administrator:f