Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources: Active Threads
Viewing all articles
Browse latest Browse all 8411

Removing inheriting permissions

$
0
0

Hi,

I wanna delete some groups from subfolder that inherit permissions from the parent.

So I first stop inheriting with this code

$acl = Get-Acl $subfolder1
$acl.SetAccessRuleProtection($true,$true)
$acl |Set-Acl

and then I try to delete the the group from the subfolder


$rule = New-Object System.Security.AccessControl.FileSystemAccessRule("$myGroup", "ReadAndExecute", "ContainerInherit, ObjectInherit", "None", "Allow")
$acl.RemoveAccessRuleAll($rule)
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule("$myGroup", "Synchronize", "ContainerInherit, ObjectInherit", "None", "Allow")
$acl.RemoveAccessRuleAll($rule)
Set-Acl $subfolder1 $acl

but I get this error

Set-Acl : The process does not possess the 'SeSecurityPrivilege' privilege which is required for this operation.
At C:\Users\...\Desktop\script.ps1:19 char:8
+ Set-Acl <<<<  $subfolder1 $acl
    + CategoryInfo          : PermissionDenied: (D:\Admin\....\XYZ:String) [Set-Acl], PrivilegeNotHeld
   Exception
    + FullyQualifiedErrorId : System.Security.AccessControl.PrivilegeNotHeldException,Microsoft.PowerShell.Commands.Se
   tAclCommand

I have admin privileges on the computer. Can somebody help me please?

Thanks


Viewing all articles
Browse latest Browse all 8411