Well, I'll start answering my own question.
To get a listing of which nodes have managed preferences on a remote Open Directory Master, you can do something like this:
dscl -u DIRADMINUSER -p -url HOST \
list /LDAPv3/127.0.0.1/TYPE MCXSettings \
| cut -d " " -f 1
Substitute in correct values for words in all caps. HOST is an IP or DNS name or your Open Directory Master. The -url setting exports the values in URL encoding, which, handily enough, means that they all stay on one line and we can apply the cut command. Note that if you want to specify the password on the commandline instead of being securely prompted for it, replaced -p
with -P 'PASSWORD'
.
For the TYPE, you most likely want to use:
- Groups (for a workgroup/group of users)
- ComputerGroups
- Computers
- Users
Let's say we have a user group (TYPE=Group) called Grade5 (ITEMNAME=Grade5). To copy the data remotely, we could substitute in for this command:
dscl -u DIRADMINUSER -p HOST \
mcxexport /LDAPv3/127.0.0.1/TYPE/ITEMNAME \
-format plist \
-o EXPORTFILE.plist
Now, you can not (easily) import the file remotely due to Radar 4122565. So, copy the EXPORTFILE.plist to the Open Directory Master where you want to duplicate settings, and, on that box, import it as follows:
dscl -u DIRADMINUSER -p \
/LDAPv3/127.0.0.1 mcximport /TYPE/NEWITEMNAME \
EXPORTFILE.plist
Note that several "application domains" (think preference files) can be managed. To see which ones are, use:
dscl -u DIRADMINUSER -p HOST \
mcxread /LDAPv3/127.0.0.1/TYPE/ITEMNAME \
-format text \
| grep "App domain" | uniq | cut -d " " -f3-
You can then export just one application domain, or even an application domain and a specific key.
dscl -u DIRADMINUSER -p HOST \
mcxexport /LDAPv3/127.0.0.1/TYPE/ITEMNAME \
-format plist \
-o EXPORTFILE.plist APP_DOMAIN KEYNAME
I might use "com.apple.dock" for the APP_DOMAIN and omit the KEYNAME if I wanted all the settings for the dock, and I might use a APP_DOMAIN of com.apple.mcxprinting with a KEYNAME of PrintFooter if I wanted just the print footer setting for printing.
After exporting the setting, you can import it as usual. (I haven't tested yet to see if it overwrites things or not.)
Lastly, note that it is possible to use mcxread and mcxset instead of mcxexport and mcximport.