mcx import via script post image

tlarkin
Honored Contributor

So, I am having a bit of issues importing MCX to a specific account post image. My post image script creates all local user accounts, and it uses the jamf binary to do so. This works fine, however, I also have this line:

dscl . -mcximport /Users/student /Volumes/CasperShare/Scripts/studentmcx.plist

Now, after I image a machine and mount the casper share manually, this works like advertised. All mcx settings are imported to that account. However if I do this in my post image script it doesn't work. Same exact code.

I have tried scripting the local admin to log in first and run the code, and scripting the student account to log in and then importing the MCX settings to the account. It doesn't seem to work until I actually do it myself.

Any ideas? This is how I need to import MCX settings to this specific account and I really need it to work on my post image script.

Thanks,

Tom

5 REPLIES 5

rockpapergoat
Contributor III

is the share mounted when your post imaging script runs?

does your script log errors?

why not just bake the local mcx into the student account and install it one shot?

i have a small educational client who needed this type of simple, locally managed generic student account, and i install it with a pkg, including mcx. i also have a routine that will download any updated local mcx and apply it on boot, just in case they need changes. it's not that elegant but works, considering they have no other management for these accounts.

tlarkin
Honored Contributor

It just dawned on me that when Casper prepares a script for first run it caches it on the machine locally...So the CasperShare is NOT mounted. Derp!

So, let me modify the script to mount the share now...

I think I like this method better for these reasons (my opinion not gospel):

1) I only ever have to maintain the MCX file itself, which is easy 2) If I gotta change anything, just gotta change the MCX file, all other items in script are good to go 3) I want to avoid repacking a whole user every time, or a plist, etc. I would have to recreate the MCX file anyway regardless.

My image is pristine, no users, no setting, just OS X and a few apps, that way I can deploy it to every mac across the board and use post image scripts and specific user/grouup/department packages and only ever have to maintain one image.

Did you package up this user in Composer?

tlarkin
Honored Contributor

The other way I could do this is have the script in a policy and run the policy as manual trigger...better idea I think!

rockpapergoat
Contributor III

curl would be simpler.

for this example, i dump (via curl) mcx under /etc/mcx, and the script takes care of importing.

https://github.com/tspgit/scripts/blob/master/accountmanagement/mcx_import.rb

tlarkin
Honored Contributor

well asr script is running, post image script will run after with the manual trigger policy running the MCX import, so it should mount the casper share. Gonna let it run over night because now it is miller time.