C
CHSTechSolutions
Guest
I am trying to use vb.net to remove a user account from a folder ACL. everything works fine when and the account is removed but all the other accounts with permission applied on that folder(not inherited) get changed to "only this folder" in the folder Properties -> Security -> Advanced -> Applies to column. Before i removed the bad account this was set to "This folder, Subfolders, and files.
below is the code i am using
Dim fSecurity As FileSecurity = File.GetAccessControl(Path)
Dim Access As AuthorizationRuleCollection = fSecurity.GetAccessRules(True, False, GetType(NTAccount))
For Each fsaRule As FileSystemAccessRule In Access
If fsaRule.IdentityReference.Value.Contains("S-1-") Then
fSecurity.RemoveAccessRule(fsaRule)
End If
Next
File.SetAccessControl(Path, fSecurity)
i get the same outcome with c# as well.
Continue reading...
below is the code i am using
Dim fSecurity As FileSecurity = File.GetAccessControl(Path)
Dim Access As AuthorizationRuleCollection = fSecurity.GetAccessRules(True, False, GetType(NTAccount))
For Each fsaRule As FileSystemAccessRule In Access
If fsaRule.IdentityReference.Value.Contains("S-1-") Then
fSecurity.RemoveAccessRule(fsaRule)
End If
Next
File.SetAccessControl(Path, fSecurity)
i get the same outcome with c# as well.
Continue reading...