Skip to content

VB.NET to Active Directory (What am I missing here?)

Mark

Asked Nov 24, 2006, 8:56 AM EST1 answer
Share
LinkedInX
Hello:

I was hoping for a bit of help. When I click on a button I want it to add a test user to Active Directory. The code debugs with no errors, but the user never shows up on my active directory list (intranet.merge3d.com\Users). All help is greatly appreciated!

VB.NET
Private Sub btnExport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExport.Click
Dim newUser As DirectoryEntry
Dim de As DirectoryEntry = New DirectoryEntry("LDAP://mcws2003.intranet.merge3d.com/CN=users;DC=intranet,DC=merge3d,DC=com")

newUser = de.Children.Add("cn=Student Smith", "user")

newUser.Properties("sAMAccountName").Add("Student_Smith")

de.CommitChanges()

MessageBox.Show("User Added")

End Sub

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    I figured it out -- it should be:

     newUser.CommitChanges()

       NOT

     de.CommitChanges() --silly mistake!
    0