将Active Directory用户导出为* .contact

有没有办法将AD用户导出到* .contact文件? (每个联系人= 1个文件)

在PowerShell中,将所有用户及其联系人详细信息导入到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 

有独立的文件(取决于你想要的格式):

 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 } 

这将把联系人详细信息按以下格式分别放到一个单独的文件中:

 Name : John Doe Title : Engineer EmailAddress : [email protected] OfficePhone : 1234 1234 MobilePhone : 1234 1234 Department : Sample Department 

如果需要,使用echo格式。

您可以使用Powershell将用户导出为CSV,然后使用Windows通讯簿导入。