Exporting AD Contacts with Powershell

Hi,
I'm currently trying to migrate our company's 1000+ mail contacts from Exchange into a contacts list in Sharepoint.

I need specific data from Active Directory for each contact which goes beyond what the Get-MailContact cmdlet can do.  I need info like Company, phone number...etc...

I downloaded Quest's tools, but it seems like their cmdlets are only for users, not contacts.

Any ideas?
jamorlandoAsked:
Who is Participating?
 
KenMcFConnect With a Mentor Commented:
try this with quest, you can add other attributes as needed.

get-qadobject -type contact | select Name, PrimarySMTPAddress | export-csv contacts.csv
0
 
Joseph DalyConnect With a Mentor Commented:
Another method of doing this would to use the CSVDE command. I have done this in the past using the command below.

csvde.exe -r "(&(objectCategory=person)(objectClass=user)(mail=*))" -l "objectClass, displayName,givenName,sn,DN,mail,mailnickname,mobile,telephoneNumber,facsimileTelephoneNumber,title," -f "c:\export.csv"

There are alot of attributes we wanted returned but you can use as many or few as you like.
0
 
AkhaterConnect With a Mentor Commented:
you don't need quest tools just use the get-contact cmdlet instead the get-mailcontact you will find all the missing attributes you are looking for


for a full list of attributes get-contact 'contact name' | fl

get-contact -resultsize unlimited | select-object name,Phone,company | export-csv contacts.csv
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
jamorlandoAuthor Commented:
@KenMcF, thanks, I will try to tweak this to my needs

@xxdcmast, wow, never heard of the csvde.exe command, but that's pretty sweet that you can do this kind of thing from the command prompt instead of powershell.  If I can't get Ken's solution to work I'll check this out.

@Akhater, I see company, and phone, but what about an attribute like "Address" which is stored in AD?
0
 
AkhaterCommented:
you mean StreetAddress?

get-contact -resultsize unlimited | select-object name,Phone,company,streetaddress

again try with on one conact get-contact contactname | fl  and you will be able to find all properties
0
 
jamorlandoAuthor Commented:
Actually Ken, when I run
Get-QADObject -type contact -Identity bjones | fl

I don't see an attribute for address either.  Is there a way to do this from quest?
0
 
AkhaterCommented:
here are the address attributes in get-contact


StreetAddress
PostOfficeBox
City
StateOrProvince
PostalCode
CountryOrRegion
0
 
KenMcFCommented:
Try it with -includedproperties *

Get-QADObject -type contact -Identity bjones -includedproperties * | fl *
0
 
jamorlandoAuthor Commented:
Thanks ... I got this figured out.  I'm going to give you guys all credit, cause all 3 of you were very helpful.
0
All Courses

From novice to tech pro — start learning today.