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