Sharing settings report (security audit) I am new to Mac administration and struggling somewhat on how to programatically report in the settings in the Sharing Preference panel (10.7 and 10.8). Basically - I want to report in which settings are on and off. I have imagined writing a script to be able to report this status back. 

I can see that for some of the settings I can use 'systemsetup' (remote login, remote Apple Events) but for others I am at a loss to where to go check to see if the following options are enabled:


DVD and CD Sharing
Screen Sharing
File Sharing (both for AFP and SMB)
Printer Sharing
Scanner Sharing
Remote Management
Internet Sharing
Bluetooth Sharing


I am less concerned about if the service is active (i.e. currently in use by someone) but initially want to just report if the options are checked on.
While I applaud the effort to learn how to collect these scripts, I would say you might just buy a copy of Apple's Remote Desktop tool.

It has pre-built data collection tools that will collect thousands of data points about each system, periodically get updates and you can run reports against the local database of last known configurations or tick a checkbox to refresh all status and then run the report.

Here is how the interface for what you ask looks:



That tool leverages ssh log in, remote apple events and Apple's own remote management hooks to be extremely flexible and running arbitrary shell scripts, custom packages, remote Apple Scripts as well as performing more direct data collection that is embedded into the OS.

The reports and data collected are all easily printed, copied or exported in tab/comma separated files for ease of re-use.