While this won't provide pretty output it will give you the information
you need (may wrap)
ldifde -f users.ldif -s w2kdc -d "searchbase" -p subtree -r
"(objectcategory=user)" -l
name,description,givenname,sn,mail,telephonenumber
w2kdc is one of your domain controllers. You can leave this off. I've
found with a empty root domain that if I don't specify a DC to query I
get the a root DC about 15% of the time.
searchbase is where you want to start searching. For the data below it
would be
-d "dc=fermilab,dc=fermi"
This will provide output like this in the file users.ldif
dn: CN=lilstrom,OU=General,OU=Users,OU=CD,DC=fermilab,dc=fermi
changetype: add
description: CD.OSS.CSI xXXXX [EMAIL PROTECTED]
mail: [EMAIL PROTECTED]
givenName: Al
name: lilstrom
sn: Lilianstrom
telephoneNumber: XXX-XXX-XXXX
You would have to write something to parse the file into what you want.
Getting the raw information for 4500 users takes a couple of seconds.
hth, al
Travis Riddle wrote:
>
> Hello everyone,
>
> I would like to retrieve a list of all of my users in Active Directory.
> I have searched several places over the last 2 days and have found a few
> scripts, but either they don't return the information I need or I can't
> get them to work. I have ordered a couple of books, but I am under a
> bit of pressure to produce this list asap.
>
> What I need is:
>
> User Name, Full Name, Description, Phone and Email Address.
>
> Mostly this info is found on the General Page in AD Users and Groups,
> except of course for User Name (or Login Name). I am sure this isn't a
> very difficult script, if I knew what the heck I was doing. I imagine I
> even found a script that would come close, but I can't figure out the
> syntax on one portion of it. If anyone could help me out I would be
> very grateful.
>
> Here is the script I got off of TechNet that may work, if someone else
> has a better one that would be terrific.
>
> The problem I have with this script is I can't figure out what
> parameters to put in the LDAP address. I assume that cn=myerken is the
> user Ken Myer. ou=management is the management OU. Dc=fabrikam is the
> Domain Name. Unfortunately if I enter similar values relevant to my
> domain, it simply returns no data. Any ideas? Thanks in advance.
>
> On Error Resume Next
> Set objUser = GetObject _
> ("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com")
> objUser.GetInfo
>
> strGivenName = objUser.Get("givenName")
> strInitials = objUser.Get("initials")
> strSn = objUser.Get("sn")
> strDisplayName = objUser.Get("displayName")
> strPhysicalDeliveryOfficeName = _
> objUser.Get("physicalDeliveryOfficeName")
> strTelephoneNumber = objUser.Get("telephoneNumber")
> strMail = objUser.Get("mail")
> strWwwHomePage = objUser.Get("wWWHomePage")
>
> strDescription = objUser.GetEx("description")
> strOtherTelephone = objUser.GetEx("otherTelephone")
> strUrl = objUser.GetEx("url")
>
> WScript.echo "givenName: " & strGivenName
> WScript.echo "initials: " & strInitials
> WScript.echo "sn: " & strSn
> WScript.echo "displayName: " & strDisplayName
> WScript.echo "physicalDeliveryOfficeName: " & _
> strPhysicalDeliveryOfficeName
> WScript.echo "telephoneNumber: " & strTelephoneNumber
> WScript.echo "mail: " & strMail
> WScript.echo "wWWHomePage: " & strWwwHomePage
>
> For Each strValue in strDescription
> WScript.echo "description: " & strValue
> Next
> For Each strValue in strOtherTelephone
> WScript.echo "otherTelephone: " & strValue
> Next
> For Each strValue in strUrl
> WScript.echo "url: " & strValue
> Next
> List info : http://www.activedir.org/mail_list.htm
> List FAQ : http://www.activedir.org/list_faq.htm
> List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/
--
Al Lilianstrom
CD/OSS/CSI
[EMAIL PROTECTED]
List info : http://www.activedir.org/mail_list.htm
List FAQ : http://www.activedir.org/list_faq.htm
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/