We use a bunch of these scripts to generate html files for our helpdesk to refer to. I've only included a couple of the ones with most general application, but once you've got one you can use the same principle to create others according to your own needs. They are run from cron on a suitable server - we use a NetWare one but Linux or Windows (using at rather than cron I guess) would be equally feasible. The only thing that is platform specific is the handling of file paths and the presentation of some of the more Novell specific attributes.
These scripts may be run on clustered web servers. Early in the script there is a check that the output path is available, and if the path is not available then the script shuts down reasonably quickly and elegantly. On a clustered web server the scripts may be run from all nodes of the cluster and will complete on the node with the data available but not error on the other nodes
To run them from Cron you need an entry in crontab on the following lines. This one assumes that the script has been saved to sys:phpscripts on a Netware platform and will be run at 20:00.
dsulist.php. This is a straightforward export of all users in the tree. It keeps the last 5 exports and also creates a separate export the first time it's run every month. This makes it possible to go back indefinitely and see where users were located in the directory tree and how they were set up. This is more useful than you might think, especially if users are off on long term leave or sickness and changes in the organisation have occurred in the meantime. The main ommission from this script is group membership, but if you have a lot of groups it harms readbility.
dsgrplist.php. This is a list of all groups in the tree, showing DN, description and listing all the group members. Like dsulist it keeps the last 5 exports and also creates a separate export the first time its run every month.
dsdisulist.php. This produces a list of the currently disabled user ids, together with the last time they logged in and some other basic information. Useful for 'housekeeping' of course.
dsexpulist.php. This produces a list of user accounts that have been used within the last 30 days and have an expiry date set which has expired within the last 30 days or will expire within the next 42 days. These three intervals are all readily configurable within the script.