Remove inheritance on Specific names folders
I have a folder structure with different top level folder names but within each folder contains two folders one called "Public" and one called "Private". I want to change the inheritance on the "Private" folder but leave the "Public" folders as it
is. I have been playing with ICACLS for this. I have a loop that removes the inheritance from the correct folder however the loop is not recursive and only works when ran from within the top parent folder. So for example here is
the folder structure:
Folder1- Folder2-
Public
Private
Folder3-
Public
Private
Folder4-
Public
Private
The loop only works if ran from within Folder2, Folder3 or Folder4. What I want to do is run it from Folder1 and search through all sub-folders.
Her is the command i'm using:
For /F "tokens=*" %I in ('dir /a:d-s-h /b ^| findstr /B /I /X /C:"Private"') DO ICACLS %I /INHERITANCE:R
I know this has to do with the /F switch in the FOR loop but i'm unsure how to get recursive to work.
Thanks for the help.
August 13th, 2012 6:31am
Hi,
Please post the query in scripting guys forum.They are the experts in scripting.
http://social.technet.microsoft.com/Forums/en-us/ITCG/threads Regards,
Rafic
If you found this post helpful, please give it a "Helpful" vote.
If it answered your question, remember to mark it as an "Answer".
This posting is provided "AS IS" with no warranties and confers no rights! Always test ANY suggestion in a test environment before implementing!
Free Windows Admin Tool Kit Click here and download it now
August 13th, 2012 6:48am
Will do.
Sorry.
August 13th, 2012 6:54am
Link to the new thread: http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/1997ac2c-b6dd-4afc-a8f5-8a6f7c9da8ae/#1997ac2c-b6dd-4afc-a8f5-8a6f7c9da8ae
This
posting is provided "AS IS" with no warranties or guarantees , and confers no rights.
Microsoft
Student Partner 2010 / 2011
Microsoft
Certified Professional
Microsoft
Certified Systems Administrator: Security
Microsoft
Certified Systems Engineer: Security
Microsoft
Certified Technology Specialist: Windows Server 2008 Active Directory, Configuration
Microsoft
Certified Technology Specialist: Windows Server 2008 Network Infrastructure, Configuration
Microsoft
Certified Technology Specialist: Windows Server 2008 Applications Infrastructure, Configuration
Microsoft
Certified Technology Specialist: Windows 7, Configuring
Microsoft
Certified Technology Specialist: Designing and Providing Volume Licensing Solutions to Large Organizations
Microsoft Certified IT Professional: Enterprise Administrator
Microsoft Certified IT Professional: Server Administrator
Microsoft Certified Trainer
Free Windows Admin Tool Kit Click here and download it now
August 13th, 2012 7:20am


