migrating from one Mac to another (new) Mac

acdesigntech
Contributor II

We're planning our annual Mac refresh project in which we'll be refreshing about 25% of our install base. One of the issues that plagues me every year is migrating departmental apps (i.e. non-core) from the old Mac to the new Mac. Currently we're generating an app report for each Mac and manually combing through it to find departmental apps. Needless to say we miss a few things, every year ;)

I've been working on a way to automate this, and currently am dynamically generating a list of all applications installed in the /Applications and /Applications/Utilities/ folders, comparing them to a pre-generated list of Departmental apps, and then matching those up to a pre-generated list of their corresponding Casper packages. If a match is found the package gets appended to the end of a dynamically sized array. After all the comparisons are done, I loop through the dynamic array and run a jamf install command for each item.

I'm doing it all in bash, so the lack of multi-dimensional array support means I have to be SUPER Careful about the ordering of the app and casper package arrays. I was thinking of reading the /Library/JAMF/Receipts directory to see what was installed and just appending to an array from that list.

Just curious, what are you all doing to handle this type of reinstall for each new Mac?

8 REPLIES 8

jarednichols
Honored Contributor

I think you can attack this differently, and maybe it'll work for you, maybe not.

  1. Assign/pick/volunteer/whatever a person in each department responsible for liaising with IT. It could be for this specific project, but hopefully it would be for ongoing contact.
  2. Have that person designate one of the departmental machines that has all of the software the department needs. (This may involve them polling their coworkers to determine if it has it all. If it does not, it'd need to be installed.)
  3. When they "bless" that system, you essentially do an ls on /Applications and whatever other folders applications are stored in.
  4. Diff this with the base set of applications the OS installs.
  5. You now, essentially, have the software loadout configuration needed for that department's build configuration that will end up in Casper Admin. Create your configurations/smart configurations from there.

I'd prefer this method as it A) lowers your workload B) puts responsibility on the department for telling you what their needs are. You can't guess them accurately.

It may be a little more legwork now, but it'll give you more maintainable system configurations down the road instead of going through this exercise every time you replace 25% of your install base.

damienbarrett
Valued Contributor

Why not just package up all the Departmental apps and make them available for installation via Self Service. Then the end-users can be responsible for installing any software that's not part of the "base" that you image with.

We're preparing for a refresh of 1000 machines in June and this is how I'll be handling all the Apps that are not part of our standard base that gets imaged onto each new MacBook Air.

We're also telling our users that we'll only be migrating their User folder. Any apps they've installed or data that resides outside of their user profile will not be migrated.

jhbush
Valued Contributor II

damienbarrett we do exactly that where I work. Another option for us since we use CrashPlan PROe is have the user be responsible for all of it. They login grab the apps from SS and then restore what they need from the CPP console to the new Mac and begin backing up new data.

acdesigntech
Contributor II

@Damien Barret: Management won't allow me to do that since there's no way to enforce licensing through self service and not many of our apps are site licensed or anything like that (le sigh), which makes packaging all sorts of fun at my company :). I won't lie, they have a pretty draconian management model. It keeps me employed though.

Also, IT staff some years before me made the mistake of calling Self Service "Install Printers" (and renaming it as such) since thats all they intended it for, and now it's an uphill battle to get our end users to do ANYTHING else with it other than add advertised printers. le sigh.

i was hoping to use the chaos that 10.8 is creating in our office to slip "Self Service" back into the mix, but it's not going as well as I planned, so putting the work of adding one-off apps on the shoulders of the user isn't really an option. I just love politics :/

@jarednichols: that may very well work to a certain degree. I already have some good rapport with our unofficial BA for our creative division, I could probably leverage that relationship to have computers set up per department, then capture those app lists and make smart groups out of them. Sadly we're not very good about keeping departments in Casper up to date though, but that's a training thing and can be shoved down throats :P

-------

Unfortunately, that's not going to work this go around, since we are just about to start purchasing for FY13 and 14 refreshes. I think I may go with our archaic manual looksee method one more time this year. 10.8 helped a whole lot with whacking the zillion PPC apps in use here. There're only maybe a dozen or two non-standards left.

acdesigntech
Contributor II

Also, hi Damien! It's Andrew (from MNN). Obviously I do not work there anymore :P

acdesigntech
Contributor II

Ok, so thanks to @mm2270, I've been able to use the JSS api to a very limited extent to extract group memberships of a Mac. Is it possible to use this to extract information from package records in the jamfsoftware DB? I'm primarily interested in the Notes and Info fields for each package.

This is the command he's using to get the group memberships:

MAC=$( networksetup -getmacaddress en0 | awk '{ print $3 }' | sed 's/:/./g' )

JSSGroups=$( curl -s -u username:password https://my.casper.server:8443/JSSResource/computers/macaddress/$MAC 
| xpath //computer/groups_accounts/computer_group_memberships[1] 
| sed -e 's/<computer_group_memberships>//g;s/</computer_group_memberships>//g;s/<group>//g;s/</group>/
/g' )

Is there any documentation on the API and how to invoke it from the command line similar to the above?

acdesigntech
Contributor II

After some trial and error, I got as far as using the GET method in the API to show this data:

<package>
<id>383</id>
<name>Adobe Acrobat 7 Pro</name>
<category>Application - Installers</category>
<filename>AdobeAcrobatPro7.dmg</filename>
<info>Includes licensing information.</info>
<notes/>
<priority>14</priority>
<reboot_required>false</reboot_required>
<fill_user_template>false</fill_user_template>
<fill_existing_users>false</fill_existing_users>
<boot_volume_required>false</boot_volume_required>
<stage>Deployable</stage>
<allow_uninstalled>false</allow_uninstalled>
<os_requirements/>
<required_processor>None</required_processor>
<switch_with_package>Do Not Install</switch_with_package>
<install_if_reported_available>false</install_if_reported_available>
<reinstall_option>Do Not Reinstall</reinstall_option>
<triggering_files/>
<send_notification>false</send_notification>
</package>

Basically what I want to do is grab the contents of the info and/or notes fields based on only the receipt name which is also the filename for the package.

This is the command i'm using but I don't know sed well enough at all to get much further than this without an error:

curl -s -u username:password https://my.casper.server:8443/JSSResource/packages/filename/$PKGNAME | xpath //package/filename

I know the command isn't complete, but not sure what to put there...

acdesigntech
Contributor II

inefficient, I know, but it works: ```
curl -s -u username:password https://my.casper.server:8443/JSSResource/packages/id/383 | xpath //package/info | grep "Replaced By:" | cut -d : -f2 | cut -d < -f1
```

You have to know that id 383 is the Acrobat 7 package (which was why I am trying to get package receipt name to be the identifying information). So in Casper admin I put "Replaced By: Acrobat9Pro.pkg" and the migration script know that if a computer has a receipt for Acrobat7Pro.pkg (ID 383), it should append Acrobat9Pro.pkg to it's reinstall array in place of Acrobat7Pro.pkg (once i program in that logic).

If anyone knows of a way to get the API info using the receipt name (XML tag is <filename>) it'd make my life easier, though since I control the array of software packages the script is looking at, I guess I could always append a '-ID-' or something to the array element and grep for that.