PowerShell Icacls permissions with domain group

icaclspowershell

I am trying to use icacls to set permissions for a domain group, but for some reason it is not working.

icacls "C:\Temp\ACL" /T /C /grant ("Everyone"+':F') ("System"+':F') ("Administrators"+':F') ("DOMAIN\groupname"+':C') >> C:\temp\c.log

I am trying to run it with Powershell, but I get the following error:

Invalid parameter "DOMAIN\groupname:C"

I have tried multiple solutions, and it works without ("DOMAIN\groupname"+':C').

Best Answer

I had an old script that did this... your code looked correct, very similar to mine. However I was granting Full control, and you were granting Change. Other CLI tools like SUBINACL, CALCS have used "C" for Change, but it would seem ICACLS decided to use "M" for Modify.

If you change ("DOMAIN\groupname"+':C') to ("DOMAIN\groupname"+':M') you'll have better luck

From the ICACLS usage output:

perm is a permission mask and can be specified in one of two forms:
    a sequence of simple rights:
            N - no access
            F - full access
            M - modify access
            RX - read and execute access
            R - read-only access
            W - write-only access
            D - delete access