Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Function SetPermissions {
Param([string]$directory, [string]$appPoolName)
$acl = Get-Acl $destination
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule($("IIS APPPOOL\{0}" -f $appPoolName), "FullControl", "ContainerInherit,ObjectInherit", "None", "Allow")
$acl.SetAccessRule($rule)
Set-Acl $destination $acl
$acl = Get-Acl $destination
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule("IUSR", "Read", "ContainerInherit,ObjectInherit", "None", "Allow")
$acl.SetAccessRule($rule)
Set-Acl $destination $acl
$acl = Get-Acl $destination
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule("IIS_IUSRS", "Read", "ContainerInherit,ObjectInherit", "None", "Allow")
$acl.SetAccessRule($rule)
Set-Acl $destination $acl
Success
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.