The Icacls command to set Files and Folders Permissions in Windows

Icacls is very usefull to script Files and Folders Permissions.

Configuration

Commands

Reset ACL

PS C:\Users\Administrator> takeown /A /R /F D:\FOLDER
PS C:\Users\Administrator> icacls D:\FOLDER /reset /T /C

Delete heritance

PS C:\Users\Administrator> icacls D:\FOLDER /inheritance:r /T /C

Set ACLs

PS C:\Users\Administrator> icacls "D:\FOLDER" /grant:r "domain.local\users":(OI)(CI)(RX,D) "domain.local\Administrator":(OI)(CI)(F) SYSTEM:(OI)(CI)(F) Administrators:(OI)(CI)(F) /T /C

Remove user

PS C:\Users\Administrator> icacls "c:\$Windows.~BT" /remove:g SYSTEM

Add a user with full rights

PS C:\Users\Administrator> icacls "c:\$Windows.~BT" /grant users:(OI)(CI)(F)

Deny rights to a user

PS C:\Users\Administrator> icacls "c:\$WINDOWS.~BT" /deny SYSTEM:(OI)(CI)(F)
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Contact :