I am Dale Hayter, a Microsoft and VMware certified Technical Consultant.

My blog has been built up over the years from my experience of working on an IT helpdesk and also from being out on-site.

Export User Details from Active Directory

With 2008 R2 Servers you can now use PowerShell to exports user details en mass.

To do this login to a 2008 R2 Domain Controller and launch Active Directory Module for Windows PowerShell from Start, All programs, Administrative Tools.

You can then use the command below to export the details to a CSV file.

Get-ADUser -Filter * -Properties * | Select-Object -Property Name,EmailAddress,physicalDeliveryOfficeName,description,homePhone,mobile,LastLogonDate | sort-object -property LastLogonDate -descending | Export-CSV -path c:\temp\adusers.csv -notypeinformation

You can change the values after -Property to collect more or less information as desired.

I’ve listed all the values from AD and what labels you should enter to retreive them.

First name – givenName
Initials – initials
Last name – sn
Display name – displayName
Description – description
Office – physicalDeliveryOfficeName
Telephone number – telephoneNumber
Other Telephone numbers – otherTelephone
E-mail – mail
Web page – wWWHomePage
Other Web pages – url

Street – streetAddress
P.O. Box- postOfficeBox
City- l
State/province – st
Zip/Postal Code – postalCode
Country/region – c, co, countryCode

User logon name – userPrincipalName
pre-Windows 2000 logon name – sAMAccountName
Account disabled? – userAccountControl
Logon Hours… – logonHours
Logon On To… (Logon Workstations) – userWorkstations
User must change password at next logon – pwdLastSet
User cannot change password – userAccountControl
Password never expires – userAccountControl
Store password using reversible encryption – userAccountControl
Account expires end of (date) – accountExpires

User Profile path – profilePath
Logon script – scriptPath
Home folder, local path – homeDirectory
Home folder, Connect, Drive – homeDrive
Home folder, Connect, To: – homeDirectory

Home – homePhone
Other Home phone numbers – otherHomePhone
Pager – pager
Other Pager numbers – otherPager
Mobile – mobile
Other Mobile numbers – otherMobile
Fax – facsimileTelephoneNumber
Other Fax numbers – otherFacsimileTelephoneNumber
IP phone – ipPhone
Other IP phone numbers – otherIpPhone
Notes – info

Title – title
Department – department
Company – company
Manager – manager