Home Forums AFP548 Community Open Mike Help trying to edit MCX settings via script

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #367230
    jdyck
    Participant

    Hey all, this is a client issue but figure I’ll have better luck finding someone with the in-depth knowledge on this site than most other places…
    I have about 1500 iBooks & MacBooks deployed to students in my school district. All of them are running under a local, managed/limited student account (we experimented with AD/OD integration but it was acting flaky for us, certainly not ready for us to deploy it to 1500 users till we got the kinks out). The users were created and the MCX settings implemented using WorkGroup Manager pointed to the local NetInfo on the computer – much nice than working with System Preferences I must say.
    Anyway I’ve discovered one app that I meant to enable for use but somehow missed (PhotoBooth for our MacBooks)… I’ve also developed an AppleScript Studio app to help users setup their printers by school, and via SMB so they actually authenticate as their AD user (up to now has just been IP LPR printing – which only shows us lists of ‘student’ printing).
    The problem now is that I want to enable the app I missed, and deploy the new printer app… Both of which mean I somehow need to update the MCX settings of the student user to allow them to run these apps. Needless to say I don’t want to visit all 1500 computers and manually edit these settings. I was hoping to create a package using PackageMaker that would include a post-install script that would edit those settings, then I could use Remote Desktop to deploy the install/fix to a class of computers at a time – still a bit tedious but definitely better than doing it all by hand.
    Unfortunately I keep running into brick walls – ie: the limits of my knowledge…
    First of all I thought I could maybe use dscl to simply add the settings for the two apps – from what I see by looking at the MCX xml records it is simply a dict entry with the info about the program like com.apple.iPhoto – easy enough to do by hand, but my scripting is really only just past newbie phase… So I spent a bunch of time looking at dscl and while it’s easy to read the information, even redirect it to a file, I don’t see any way to simply edit the one setting. If it was just a simple setting like shell path or home folder, no problem, but I don’t seen any way to edit an inline XML file, like the MCX stuff is…
    So… next thought was that I could redirect the ‘read’ operation of the MCXSettings of the user to a file, edit it there, then load it back into NetInfo again with a dscl -write command… And it’s an XML file, so I might even be able to use the defaults command to make the updates… Another rabbit hole I guess – first problem is the text file I create has “MCXSettings:” right at the top which ruins the XML formatting, so I need to delete that before I can do any editing with defaults… Even once I do that, i find there are actually several MCX entries all in a row, each as a valid XML file… dock settings, app settings, etc… defaults doesn’t seem to like that very much… Even if I narrow it down to just one XML file I can’t seem to find the proper settings to edit the setting I need as it is pretty far nested in the structure, something like so…
    Root (Dictionary)
    • mcx_application_data (Dictionary)
    • com.apple.applicationaccess (Dictionary)
    • Forced (Array)
    • 0 (Dictionary)
    • mcx_preference_settings (Dictionary)
    • ItemsList-Raw (Dictionary)
    • com.apple.iPhoto (Dictionary) with 0 key/value pairs
    If I do something like: defaults ~/filename write Itemslist-Raw add-dict com.apple.iPhoto there are two problems:
    1) It doesn’t want to create a dict entry without data to go with it, and
    2) It creates a new ItemsList-Raw entry at the same level as the parent mcx_application_data…
    I’ve tried experimenting with using paths like i would in a directory, ie: /mcx_application_data/com.apple.applicationaccess/… but that doesn’t work either. I’ve also tried some other variations of syntax all with no luck.
    I’m starting to think I need to go a lot deeper than my knowledge here, and get into awk or Perl or something, so I can actually to do text editing that way… But then I try and pipe the mcx file back into the NetInfo db using dscl and that doesn’t work either, so not sure it’s even worth the effort.
    Does ANYBODY out there have any idea how to do this? Is it even possible or am I up a creek with no way to paddle back? I’m kinda running at the limits of my knowledge here, but would LOVE to learn how to do this.

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.

Comments are closed