Dear stackoverflow community, time to ask my first (and maybe stupid) question here :)
I am facing the following problem at the moment and hope that maybe some of you can help me with this:
for reasons, I have to query our Active-Directory to get some user data and write it into an CSV file on my Linux machine. For the query, I use the ldapsearch utility. Basically I was able to get this to work and query the user attributes i need. Now I'm facing the problem, that I have some users, that dont have one or more of the queried attributes set (e.g. "othertelephone"). In this case, ldapsearch does not include these empty attribute(s) in the output/result.
Is there a possibility to include all queried attributes in the result/output, even if they are not set or empty? The reasons I need this, is to keep a uniform clean format of the output (to convert the output into CSV easily later on). So e.g. if Attribute "othertelephone" is empty, I want to have the output looks like that:
sn: abc
givenName: xyz
othertelephone:
memberOf: blablabla
instead of
sn: abc
givenName: xyz
memberOf: blablabla
Sadly, I have not found any switch of the ldapsearch command with which I can achieve this. Is this even possible with ldapsearch or which other way can i go? I am thankful for every hint you can give to a beginner.