Richard
Mon Jan 29 21:21:17 CST 2007
Yes. The ADO query in the example program is:
strQuery = "<LDAP://" & strDNSDomain & ">;" & strFilter _
& ";distinguishedName;subtree"
The first clause of the ADO query is the base of the search. In this case,
strDNSDomain is the Distinguished Name of the domain, so the entire domain
is searched. You could substitute the Distinguished Name of an OU. For
example:
strOU = "ou=Sales,dc=MyDomain,dc=com"
strQuery = "<LDAP://" & strOU & ">;" & strFilter _
& ";distinguishedName;subtree"
--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab web site -
http://www.rlmueller.net
--
"Jeremy Schubert" <jschubert@no*spam.shaw.ca> wrote in message
news:ubatbCBRHHA.4000@TK2MSFTNGP04.phx.gbl...
> Richard, re your CreateUserList3.vbs file. Can I modify the ldap path to
> extract names only from one OU?
> "Richard Mueller [MVP]" <rlmueller-NOSPAM@ameritech.NOSPAM.net> wrote in
> message news:%23oREJn8QHHA.1200@TK2MSFTNGP02.phx.gbl...
> > Jeremy wrote:
> >
> >> Richard and Randy, both your suggestions are very straight forward and
> >> logical. I'll have to decide which one I want to use.
> >>
> >> I ran the script today and it seems to work well except that it left
the
> >> $
> >> off the end of the home directory share listings in ADUC. So I'll
> > probably
> >> do what I'm used to doing. Select all the users in the OU and edit
their
> >> properties to clear the home directory share listing.. Then I'll
> >> redirect
> > a
> >> directory listing of the Users folder to a text file and will open that
> > txt
> >> file in Excel to make a script to add the proper home share path.
> >>
> >> But I was wondering if there was an easier way to do it. For example,
I
> >> though after clearing all of their home shares listings (there home
> >> shares
> >> by the way are comprised of their "\\server\CN-LastName$), I could
then
> > use
> >> a line like \\server\%CN%-%lastname%$. Do either of you have a
> >> suggestion
> >> for me?
> >
> > If a program can determine the new value from the old, it can be done in
> > one
> > step. A program can enumerate all users, retrieve the old value,
determine
> > the new value, assign the new value, and save. To determine the new
value
> > for the homeDirectory attribute, the program has the old value, plus the
> > values of sAMAccountName, cn, givenName, sn, and all other attributes to
> > work with.
> >
> > To enumerate users, you can either enumerate the user objects in a
> > container/OU, or use ADO. ADO can retrieve any attribute values for all
> > users. Because ADO cannot modify, you would also retrieve
> > distinguishedName,
> > so you can bind to the user objects to make the changes.
> >
> > If I understand, the program would determine "\\server" from the old
value
> > for homeDirectory, then use the values for cn (Common Name) and sn (last
> > name) to construct the new value. Are you sure you don't want to use
> > sAMAccountName (the NT name of the user, also called the pre-Windows
2000
> > logon name) instead of cn? sAMAccountName is unique in the domain, while
> > Common Name need only be unique in the container/OU. There can be
several
> > users with the same value for cn.
> >
> > For information on using ADO, see this link:
> >
> >
http://www.rlmueller.net/ADOSearchTips.htm
> >
> > Otherwise, if this approach is not feasible, I have sample programs that
> > update profilePath for users according to the information in an Excel
> > spreadsheet. This first example identifies users by Distinguished Name:
> >
> >
http://www.rlmueller.net/UpdateUserProfile.htm
> >
> > This second example is the same, but identifies users by sAMAccountName:
> >
> >
http://www.rlmueller.net/UpdateUserProfile2.htm
> >
> > Either program could be modified to assign values to homeDirectory
instead
> > of profilePath.
> >
> > --
> > Richard
> > Microsoft MVP Scripting and ADSI
> > Hilltop Lab web site -
http://www.rlmueller.net
> > --
> >
> >
>
>