Go Back   Forum Care Forums > Development Reference Area > Visual Basic

Reply
 
LinkBack Thread Tools Display Modes
Remove Inherited NTFS Folder Perms
Old
  (#1)
Dan Crossett
Guest
 
Posts: n/a
Default 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
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Contact Us - Forum Care Forums - Archive - Top