Help me! How I could make user in active directory

From: Sara Rafiee via .NET 247 (anonymous_at_dotnet247.com)
Date: 10/31/04


Date: Sun, 31 Oct 2004 03:55:00 -0800

hello
can anyone help me making user in active directory , I wrote a code, but it could't work, could anyone correct it. thanks in advance.
 Sub example()
        'Put user code to initialize the page here
        'Try
        Dim AD As DirectoryEntry = _
          New DirectoryEntry("LDAP://mydomian", "adminuser", "adminpassword", AuthenticationTypes.Secure Or AuthenticationTypes.Sealing)
            Dim NewUser As DirectoryEntry = AD.Children.Add("TestUser1", "user")
        NewUser.Invoke("SetPassword", New Object() {"12345Abc"})
            NewUser.Invoke("Put", New Object() {"Description", "Test User from .NET"})
            NewUser.CommitChanges()
            Dim grp As DirectoryEntry

            grp = AD.Children.Find("Guests", "group")
            If grp.Name <> "" Then
                grp.Invoke("Add", New Object() {NewUser.Path.ToString()})
            End If
        

            'Catch ex As Exception
            ' Console.WriteLine(ex.Message)
            ' Console.ReadLine()
            'End Try
    End Sub

--------------------------------
From: Sara Rafiee

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>w/HG3eHg3EaGJ5kARLMuBw==</Id>