Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Remove ACL Issue

$
0
0

Hello All,

I was simply looking to remove the builtin\users acl from a network share and my logic - as far as I can tell - seems to be correct in the script that I wrote for it; I don't receive any error messages either, but when I go check ACLS, it's not removed. Below is what I'm working with"

$acls = Get-Acl '\\nyc-filer\shared\singapore compliance'

foreach ($acl in $acls) {
    
    $folder = (convert-path $acl.pspath)
    
    foreach($access in $acl.access) {
                   
       if($access.IdentityReference -eq 'BUILTIN\Users') {
               
           $acl.RemoveAccessRule($access)
                               
        }
        
    }
Set-Acl -Path $folder -AclObject $acl
}
 


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>