jamf casper fill existing users (feu) does not work, and how to work around it

Sometime after Casper Suite 5, the Fill Existing Users (FEU) option that one could pick for a dmg package uploaded to Casper Admin stopped working. This is due in part to the changes Apple made from storing users in the NetInfo database to dslocal. Casper no longer knew where to look for user account information and as a result, you could no longer populate existing user accounts simply by selecting a checkbox for a package. The Fill User Template (FUT) option is still functional, but as with FEU only works with dmg style packages. I use the following code snippet to work around not having a functional FEU option in Casper, and as my company moves toward a standardized .pkg workflow, will come in handy for FUT operations as well. As always, feel free to use my code, but I take no responsibility for you doing so:

#!/bin/sh
########################################################### START HEADER ############################################################
## Use this script freely as long as you keep this header intact
## FillExistingUsers.sh written by Andrew Caldwell, 3/2012
## Although this script is tested and functional on 10.5 and 10.6, your mileage may vary and I accept NO responsibility for you
## using this script on your own Mac(s)
########################################################### END HEADER ############################################################
## Loop through each item in /A/U/ISD/Inst/U S/
for PREF_ITEM in /Applications/Utilities/ISD/Installs/User\ Settings/*;
do
     ## Loop through each user account in /Users/
     for USER_HOME in /Users/*;
          do
               ## Get the short name of each user account (this of course doubles as the users' folder
               USER_ID=`basename "${USER_HOME}"`
               ## For each user account found (except Shared), sync the items in the User\ Settings folder
               if [ "${USER_ID}" != "Shared" ]; then
                    rsync -avE "${PREF_ITEM}" ${USER_HOME}
                    ## Set the correct ownership and mode on the new user-level files/folders
                    chown -R $USER_ID:"DOMAIN\Domain Users" "${PREF_ITEM}"
                    chmod -R 700 "${PREF_ITEM}"
               fi
          done
done

I have packages that install files intended to fill user-level folders like Library, Documents, and so forth, into a centrally located folder (ex: a package would install a user setting here: /Applications/Utilities/ISD/Installs/User\ Settings/Library/Preferences/com.apple.SoftwareUpdate.plist). Then this script essentially says, for every folder inside the User\ Settings directory, sync it’s contents to each user account in /Users/. Since we are syncing folders and not individual files, rarely will we ever see more than one or two iterations of that top level “for PREF_ITEM…” loop (unless you have multiple folders in there of course).

The “${}” notation makes the shell expand the entire path, useful for iterating over paths that we may or may not know the names of. In this way we can say “sync whatever is in the User Settings folder” without worrying about what paths are in there. One caveat though is that the path names must match the path names inside the user folder or rsync will create them. Unless your intent is to create new user-level folders, for expected operation, ensure the paths in your package are correct.


About this entry