Remove Inherited NTFS Folder Perms

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dan Crossett

    #1

    Remove Inherited NTFS Folder Perms

    I am trying to remove the inherited rights for the group Users at the
    directory level \\server\share\ directory.
    Questions:
    Why doesn't the code below work, or what would be a better/easier way
    to do it?
    Thanks,
    Dan


    Dim sec As New ADsSecurity
    Dim sd As IADsSecurityDes criptor
    Dim dacl As IADsAccessContr olList
    Dim ace As IADsAccessContr olEntry

    Set sec = CreateObject("A DsSecurity")
    Set sd = sec.GetSecurity Descriptor("FIL E://\\server\share\ directory")
    Set dacl = sd.Discretionar yAcl

    For Each ace In dacl
    If ace.Trustee = "BUILTIN\Us ers" Then
    Debug.Print "Trustee: " & vbtab & ace.Trustee
    Debug.Print "AccessMask : " & vbtab & ace.AccessMask
    Debug.Print "AceFlags: " & vbtab & ace.AceFlags
    Debug.Print "AceType: " & vbtab & ace.AceType
    Debug.Print "AceFlags: " & vbtab & ace.Flags
    dacl.RemoveAce ace
    End If

    Next
    sd.Discretionar yAcl = dacl
    sec.SetSecurity Descriptor sd
Working...