I'm using the code below to set folder permission on a mapped network drive. It seems to function correctly - people who need access can access those that don't can't. Simple enough. The funky part is that when I view the security settings (right click>properties>security) there are no checks in any of the boxes for any users. However if I click the Advanced button, I see entries for all the users and the proper permissions.
Any thoughts on how to get the checks to show up? I also welcome any comments or opinions on the use of "SetAccessRuleProtection" to remove inheritance from the the parent folder.
Thanks in advance!
Any thoughts on how to get the checks to show up? I also welcome any comments or opinions on the use of "SetAccessRuleProtection" to remove inheritance from the the parent folder.
Thanks in advance!
Code:
Sub AddDirectorySecurity(ByVal strProjectPath As String, ByVal strSubFolder As String)
My.Computer.FileSystem.CreateDirectory(strProjectPath & strSubfolder)
Dim di As New IO.DirectoryInfo(strProjectPath & strSubFolder)
Dim ds As DirectorySecurity = di.GetAccessControl()
ds.SetAccessRuleProtection(True, False)
ds.AddAccessRule(New FileSystemAccessRule("builtin\administrators", FileSystemRights.FullControl, AccessControlType.Allow))
ds.AddAccessRule(New FileSystemAccessRule("system", FileSystemRights.FullControl, AccessControlType.Allow))
ds.AddAccessRule(New FileSystemAccessRule("builtin\users", FileSystemRights.FullControl, AccessControlType.Allow))
di.SetAccessControl(ds)
End Sub