Re: Help me! How I could make user in active directory

From: Chris (christhumann_at_hotmail.com)
Date: 10/18/04


Date: 18 Oct 2004 10:17:24 -0700

This is the easiest and most straight forward way I have seen for
communicating with Active Directory.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi/adsi/searching_with_activex_data_objects_ado.asp

And check the index on the left in MSDN. It has examples for just
about everything you need to do with Users/Groups and AD.

Chris

"Joe Kaplan \(MVP - ADSI\)" <joseph.e.kaplan@removethis.accenture.com> wrote in message news:<uOyoPNNtEHA.2956@TK2MSFTNGP12.phx.gbl>...
> The canonical sample is right here in the MSDN docs:
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sds/sds/creating_users.asp?frame=true
>
> Note that the name of the new object must be specified as CN=TestUser1, not
> TestUser1.
>
> A couple other points:
> - You don't have to use Put via Invoke with normal attribute values. You
> can just set the Value property directly
> - You probably need to create the object and commit it before setting the
> password
> - You may also need to set userAccountControl appropriately to enable it.
>
> Joe K.
>
> "Sara Rafiee via .NET 247" <anonymous@dotnet247.com> wrote in message
> news:uRy$EGDtEHA.2804@TK2MSFTNGP14.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>xWKmIfL0kkOgIPZLyWlpWQ==</Id>



Relevant Pages

  • Export Usernames from an OU
    ... just one OU in active directory called council staff. ... Call ExcelSetup("Sheet1") ' Sub to make Excel Document ... Set objwb = objExcel.ActiveWorkbook.Worksheets ...
    (microsoft.public.scripting.wsh)
  • Re: Export Usernames from an OU
    ... just one OU in active directory called council staff. ... Call ExcelSetup("Sheet1") ' Sub to make Excel Document ... Set objwb = objExcel.ActiveWorkbook.Worksheets ...
    (microsoft.public.scripting.wsh)
  • Re: How to HANDLE an Access Violation error
    ... > The MSDN states that the error mode is for a process and its child ... Does this mean that unhandled exceptions within called DLL's ... >> Exit Sub ... >> Public Function UnhandledExceptionFilter(ExceptionInfo As ...
    (microsoft.public.vb.winapi)
  • Re: View number of objects in entire OU?
    ... To count number of objects in an OU (and sub OU's): ... ' Search entire Active Directory domain. ... ' Filter on all objects. ... ' Construct the LDAP syntax query. ...
    (microsoft.public.windows.server.active_directory)
  • searching for a user in active directory by username
    ... then find them in active directory and set the "User must change ... Shared Sub main ... Dim DSESearcher As DirectorySearcher = New DirectorySearcher ... Dim objResults As SearchResult ...
    (microsoft.public.dotnet.framework)