A Digital Age Deserves A Digital Leader

Need help creating Active Directory Users in ASP.net

Need help creating Active Directory Users in ASP.net

Postby OrphicFireball » Wed Sep 01, 2004 9:39 pm

I found code to create users in active directory online, and it's not all that hard.

Code: Select all
           Dim AD As System.DirectoryServices.DirectoryEntry = _
                    New DirectoryServices.DirectoryEntry("WinNT://domain.com")
                Dim NewUser As DirectoryServices.DirectoryEntry = AD.Children.Add(username, "user")

                NewUser.Invoke("SetPassword", New Object() {password})
                NewUser.Invoke("Put", New Object() {"Description", "Test User from .NET"})
                NewUser.Invoke("Put", New Object() {"Fullname", lastname & ", " & firstname})
                'NewUser.Invoke("Put", New Object() {"AccountDisabled", True})
                Try
                    NewUser.CommitChanges()
                Catch ex As Exception
                    lblstatus.Text = "An Error has occured: " & ex.ToString
                End Try


I know I left out a few of my variables for username and such, but you get the idea. The thing is that active directory can hold a lot more information such as "phone number", "address", "department", and "title". I would like to add this kind of information to my user accounts as I create them on this page. Does anyone know any more about how to use invoke method, or can find a information on how to add this information?
"Pencil and paper /n./: an archaic information storage and transmission device that works by depositing smears of graphite on bleached wood pulp. More recent developments in paper-based technology include improved `write-once' update devices which use tiny rolling heads similar to mouse balls to deposit colored pigment. All these devices require an operator skilled at so-called 'handwriting' technique."
PRO Level 12
User avatar
Posts: 612
Joined: Sat Aug 14, 2004 7:43 am
Location: USA

Postby OrphicFireball » Sun Sep 05, 2004 9:22 pm

If anyone is interested I figured this out. It turns out the WinNT: provider is very limited, and when I switched to LDAP, it worked a lot better.
"Pencil and paper /n./: an archaic information storage and transmission device that works by depositing smears of graphite on bleached wood pulp. More recent developments in paper-based technology include improved `write-once' update devices which use tiny rolling heads similar to mouse balls to deposit colored pigment. All these devices require an operator skilled at so-called 'handwriting' technique."
PRO Level 12
User avatar
Posts: 612
Joined: Sat Aug 14, 2004 7:43 am
Location: USA

Return to HTML, CSS, and Scripts

Who is online

Users browsing this forum: No registered users and 12 guests

cron
cron