ldapsearch and XML

Hello all

I would like to know if it's possible to extract users from Active Directory and parse the output to obtain a XML file with specific format.

So the AD is a windows machine, and I would like to extract from a red hat linux serveur. I try ldapsearch command and ok I'm abble to extract data, but I must change the file to XML special file.
Just one exemple of parsing could be ok...
Thanks a lot

Rather than looking at an XML export from AD, how about running:

$ getent passwd
$ getent group

for instance to get lists of each, is that what you are after?

This assumes nsswitch.conf, pam.conf and ldap.conf are configured to use LDAP to query AD on your RedHat machine. Or by using SAMBA/Winbind as is mentioned in Active Directory Integration with Samba in RHEL/CentOS 4 ?? Linux Mail Server Setup and Howto Guide and in http://www.cendio.com/resources/docs/tag/winauth.html .

This can be done in perl using Net::LDAP module and XML::Writer module.

Hello Tony
I do not anderstand your answer...The command you specify.
Well I'll look the perl ldap module,
Maybe some of you have some exemple of code?

Thanks

If you run the getent commands I have suggested on the Unix client you will get a list of all the users and groups without having to export and munge files on the LDAP server.

It's possible the OP would like to extract Active Directory data that has nothing to do with his/her Linux authentication scheme, perhaps for some other use.

It's possible to pull the data with Perl's Net::LDAP and also with Python. And you don't even need a module to write XML data, though it might be easier if you wanted to write very complex XML.