Have you checked out all the examples in the documentation? They are pretty
before your first commitChanges. It is also probably a good idea to do this
"Sara Rafiee via .NET 247" <anonymous@dotnet247.com> wrote in message
news:eN5I0B0vEHA.2540@TK2MSFTNGP09.phx.gbl...
> 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>