Setting inheritance on folder structure with iCACLS

icaclspermissionsvbscript

New to this forum. I am trying to finish up a script that creates a folder structure and assigns permissions via icacls. I have the script working correctly except for one thing. When setting permissions with iCacls the folders have inheriting permissions set on. I want the permissions to be only set for that folder and not inheriting to the child folders/files. Currently the command that I am using is:

intRunError = objShell.Run("%COMSPEC% /c Echo Y| icacls " & strFolderPath & " /c /grant Administrators:(NP)(RX) ", 2, True)

I thought that the (np) setting would do the trick but no love…. I don't have much experience using icacls and would appreciate any insight on how to prevent inheritance of permissions when creating folders(w/vbscript) and assigning permissions with iCACLS. A full explanation on how to do this would be enlightening as I can't find a clear description (for me at least) of how to do this task.

Thanks in advance.

Best Answer

I strongly suggest you find a utility called SetACL. It is much more powerful than ICACLS, plus the utility's website also provides a very good introduction to NTFS privileges.

(Sorry, I'm typing this on my smartphone, so I can't directly give you the site myself).