It would help: tenforums.com/general-support/117036-icacls-remove-user-variable.html#post1489274
I guess the script needs to be adapted.
icacls "<path>" /reset /t
icacls "<path>" /inheritance:d /t
E.g:
icacls "C:\tools" /reset /t
icacls "C:\tools" /inheritance:d /t