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.

Anuj holds professional certifications in Google Cloud, AWS as well as certifications in Docker and App Performance Tools such as New Relic. He specializes in Cloud Security, Data Encryption and Container Technologies.

Initial Consultation

Anuj Varma – who has written posts on Anuj Varma, Hands-On Technology Architect, Clean Air Activist.