Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export users and Exchange properties to Excel

Status
Not open for further replies.

Lukey

Technical User
Joined
Jul 5, 2000
Messages
103
Location
GB
Sorry if this is an easy one but I can't seem to find a way to export a group of users to Excel or a csv.
I can get the usernames but I also need the Exchange properties like Manager, Phone etc.

Any help would be much appreciated.
 
CSVDE is one way to do it. The first code section is a BAT file that exports a list of users with 7 attributes. Replace "yourdc" and "yourdomain" as appropriate. You can also add/remove attributes as needed. To figure out attribute names you can use the second code listing to dump a list of all users and the various attributes.

Export user list to CSV
Code:
@echo off
rem Set variable to create the filename
for /f "tokens=1-4 delims=/ " %%i in ('date /t') do set dtfile=%%l%%j%%k

csvde -f users_list%dtfile%.csv -s yourdc -d "dc=yourdomain,dc=com" -p subtree -r "(&(objectCategory=person)(objectClass=user))" -l "displayName,description,physicalDeliveryOfficeName,l,mail,telephoneNumber,manager"

Export all users
Code:
@echo off
rem Set variable to create the filename
for /f "tokens=1-4 delims=/ " %%i in ('date /t') do set dtfile=%%l%%j%%k

ldifde -f users%dtfile%.txt -s yourdc -d "dc=yourdomain,dc=com" -p subtree -r "(&(objectCategory=person)(objectClass=user))"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top