| Remove Inherited NTFS Folder Perms -
06-04-2007, 09:46 AM
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 IADsSecurityDescriptor
Dim dacl As IADsAccessControlList
Dim ace As IADsAccessControlEntry
Set sec = CreateObject("ADsSecurity")
Set sd = sec.GetSecurityDescriptor("FILE://\\server\share\directory")
Set dacl = sd.DiscretionaryAcl
For Each ace In dacl
If ace.Trustee = "BUILTIN\Users" 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.DiscretionaryAcl = dacl
sec.SetSecurityDescriptor sd |