I was trying to use Powershell to automate a task to set special permissions
to folders.
It consist of special permissions that applies to the root folder, and a
different set of permission to subfolders and files for the SAME user.
I can do it manually but when I try to use set-acl, it doesn't seem to allow
2 access rules for the same user.
No error is reported only the last access rule overwrites whatever setting
was there for that specific user.
Any help will be highly appreciated.
Thanks,
Marcus
Here is my code:
$str = "CONTOSO\TEST1","Modify, Synchronize","none","none","Allow"
$str1 = "CONTOSO\TEST1","FullControl","ContainerInherit,
ObjectInherit","InheritOnly","Allow"
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule
$str
$accessRule1 = New-Object System.Security.AccessControl.FileSystemAccessRule
$str1
$ACL = get-acl c:\TEST
$ACL.SetAccessRule($accessRule)
$ACL.SetAccessRule($accessRule1)
Set-Acl c:\TEST $ACL # Set the Permission
$ACL.AddAccessRule($accessRule)
$ACL.AddAccessRule($accessRule1)
for additional information see:
http://msdn.microsoft.com/en-us/library/d49cww7f.aspx
"Marcus Juca" <Marcu...@discussions.microsoft.com> wrote in message
news:35DADB13-5AFB-453C...@microsoft.com...
Thanks,
Marcus