Getting ICACLS working in powershell
Here’s a sample – granting rw access to the user group IIS_IUSRS
Direct Powershell cmd
icacls "$initFolder" "/grant:r" "BUILTIN\IIS_IUSRS:(OI)(CI)RX" /t
Or – using Invoke-Expression
$Grant = “grant:rw” $users = “BUILTIN\IIS_IUSRS” $permission = “:(OI)(CI)(F) /T” Invoke-Expression -Command (‘icacls $initFolder $Grant “${$users}${$permission}”’)
Summary
icacls has weird syntax. Powershell, though less weird, has it’s own quirks. Getting this to work took me a while…Hope it helps you somewhat.
Leave a Reply