Hi,
I want to set folder permissions to two folders "f:\first" and "f:\first\second" On the "first folder" the user has to have "FullControl" permissions, on the "second" folder I want the
user having "Read" permissions.
I also don't want that changing the permissions to read/write in the first folder of a new user is going to change the permissions on the second folder to the old users already there.
I have run this script
#For the folder first
$acl = Get-Acl $homeShare
$FileSystemRights = [System.Security.AccessControl.FileSystemRights]"FullControl"
$AccessControlType = [System.Security.AccessControl.AccessControlType]"Allow"
$InheritanceFlags = [System.Security.AccessControl.InheritanceFlags]"ContainerInherit, ObjectInherit"
$PropagationFlags = [System.Security.AccessControl.PropagationFlags]"InheritOnly"
$AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule ($User, $FileSystemRights, $InheritanceFlags, $PropagationFlags, $AccessControlType)
$acl.AddAccessRule($AccessRule)
Set-Acl -Path $homeShare -AclObject $acl -ea Stop
# for the second folder
$acl2 = Get-Acl $homeShare
$FileSystemRights2 = [System.Security.AccessControl.FileSystemRights]"Read"
$AccessControlType2 = [System.Security.AccessControl.AccessControlType]"Allow"
$InheritanceFlags2 = [System.Security.AccessControl.InheritanceFlags]"ContainerInherit, ObjectInherit"
$PropagationFlags2 = [System.Security.AccessControl.PropagationFlags]"InheritOnly"
$AccessRule2 = New-Object System.Security.AccessControl.FileSystemAccessRule ($User, $FileSystemRights2, $InheritanceFlags2, $PropagationFlags2, $AccessControlType2)
$acl2.AddAccessRule($AccessRule2)
Set-Acl -Path $homeShare -AclObject $acl2 -ea Stop
I run both in the same script, It all goes through without error and "First" folder is set to read/write for the user but "second"
is set to "custom" . Any idea what I should change?
Thanks