0

Is there a way to export AD Users to a *.contact file? (each contact = 1 file)

Fabian
  • 21

2 Answers2

3

On Powershell to import all users and their contact details to CSV:

Import-Module ActiveDirectory 
Get-ADUser -filter * -Properties DisplayName, EmailAddress, Title, Department,OfficePhone,MobilePhone | Select Name,Title, EmailAddress, OfficePhone, MobilePhone, Department  | Export-Csv contacts.csv

To have separate files (depends on which format you want):

Import-Module ActiveDirectory     
$allusers = Get-ADUser -filter * | Select SamAccountName

    foreach ($user in $allusers) {

        $user = $user.SamAccountName
        $contact = Get-ADUser $user -Properties DisplayName, EmailAddress, Title, Department,OfficePhone,MobilePhone | Select Name,Title, EmailAddress, OfficePhone, MobilePhone, Department

        echo $contact > $contact.Name

    }

That will put the contact details each to a separate file in the following format:

Name         : John Doe
Title        : Engineer
EmailAddress : jdoe@email.com
OfficePhone  : 1234 1234
MobilePhone  : 1234 1234
Department   : Sample Department

Format as you like using echo if needed.

Neo
  • 41
  • 2
1

You can export users with Powershell to a CSV then import using Windows Address Book.

smwk
  • 570
  • 2
  • 5
  • 14