directoryservices

grant account access to folder

I have the following code to grant account access to some folder: DirectoryInfo info = new System.IO.DirectoryInfo("C:\MyFreeFolder"); DirectorySecurity access = info.GetAccessControl(); FileSystemAccessRule rule = new FileSystemAccessRule("NETWORK SERVICE", FileSystemRights.FullControl, AccessControlType.Allow); access.AddAccessRule(...

What's the best sequence to compress binary data, encode it, and convert to string?

I'm trying to store a gzipped binary serialized object into Active Directory's "Extension Attribute", more info here. This field is a Unicode string according to it's oM syntax of 64. I'm saving the binary object into AD's Unicode format like this: byte[] bytes = ... // This is my blob System.Text.Encoding.Unicode.GetString(bytes); ...

directoryservices.directorysearcher loop has error A column named 'cn' already belongs to this datatable

I have a function that searches AD for members of various groups. If I remove the loop, I don't get the error "A column named 'cn' already belongs to this datatable", however, I need to iterate through each OU. Function getCOMDLNames(ByVal searchStr As String) As DataTable Dim MySearchRoot As DirectoryEntry = New DirectoryEntry("pat...

LDAP query to return all groups in specified OU

I am trying to update my filter currently appled to the People Picker in SharePoint (WSS). I am using stsadm to set the filter. Something like... stsadm -o setproperty -url http://webserver:39770 -pn peoplepicker-searchadcustomfilter -pv "(&(userAccountControl=512)(objectCategory=person)(objectClass=user)(memberOf=cn=All Users Group,...

How to get Active Directory Attributes not represented by the UserPrincipal class

What I mean is that right now I am using System.DirectoryServices.AccountManagement and if I use UserPrincipal class I only see the Name, Middle Name, etc so in my codes it like UserPrincipal myUser = new UserPrincipal(pc); myUser.Name = "aaaaaa"; myUser.SamAccountName = "aaaaaaa"; . . . . myUser.Save(); How would I see the attribute...

How do I properly read the AccessFlags property using DirectoryServices on IIS 7.x?

I have IIS 7.5 on Windows 7 x64 and IIS 7.0 on Windows 2008 SP2 x86. In both cases, all the IIS 6 Compatibility features have been installed. In IIS Manager, I have created a virtual directory named TestAccess with the physical path c:\inetpub\wwwroot\TestAccess I am trying to read the AccessFlags properties using VB.NET code like th...

Trying to create a new Active Directory user, Invoke("SetPassword",pwd) throws "The RPC server is unavailable"

I'm trying to create a new user on my development active directory server using .NET System.DirectoryServices namespace. I try using the following code: DirectoryEntry dirEntry = new DirectoryEntry(path, "TESTDOM\\Administrator", "2109password", AuthenticationTypes.Secure | AuthenticationTypes.ServerBind); object o = dirEntry.NativeOb...