Use command to export AD LDAP address book

  Recently due to the epidemic,Some colleagues use Webmail instead of working from home,Therefore, you need to export the LDAP address book to a csv file,Remit to the mail system。Checked it online,Fortunately, this action is not difficult (I remember that the commands used in AD were very complicated before),Just use the built-in csvde command that specializes in processing csv.。

 

【demand】
 ◎ For displayName、mail value object export。
 ◎ Export displayName、mail field (Attributes)。

 

csvde -r "(&(mail=*)(displayName=*)" -l displayName,mail -u -f adds.csv

# -r 針對屬性做篩選。
# -l 要匯出的欄位。
# -u 以 Unicode 格式匯出。
# -f 匯出成 csv 檔。

 

  After the actual export,There will be a small amount of unexpected data,Filter parameters can be added to the results。I, for one,Some of the data was originally set by me for separate use,I set the mail attribute of these objects to null or No-Mail-Group,Therefore, the following command can be used to exclude:

csvde -r "(&(mail=*)(displayName=*)(!mail=null)(!mail=No-Mail-Group))" -l displayName,mail -u -f adds.csv

 

[Reference]

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.