Showing posts with label ipad. Show all posts
Showing posts with label ipad. Show all posts

Bashing a broken feature of Apple Configurator 2

I have commented before on some of Apple Configurator 2's (AC2) broken features. There are even some new annoyances that have come to light that make me wonder if Apple hired some high school students for a weekend to program AC2.

One of the biggest things that Apple broke in AC2 that worked just fine in Configurator 1 (AC1) is related to the device names. If you manage a large set of shared iPads, you probably need to fully wipe the iPads from time-to-time to clear out personal user data. Wiping the iPads with a Prepare job is easy enough. Unfortunately, when you run the Prepare job, AC2 resets the names of the iPads and completely forgets the previously assigned names! This is a huge problem when you're trying to troubleshoot issues with a specific iPad. In AC1, the iPads would get renamed to the previously assigned name. I have no idea why Apple removed this functionality in AC2.

In my previous post, I described how to use AC2 in combination with AC1. The Prepare is done via AC2 (which has some iOS 9+ specific Prepare options not found in AC1), and then run AC1 to rename the iPads. Unfortunately, we just replaced the Macs used to manage our iPads and AC1 doesn't just want to rename the iPads, but now wipes them too (undoing the Prepare job). There may also be people out there who don't have AC1 (and don't feel comfortable retrieving it from some sketchy download site).

Bash to the rescue!

AC2 does include a very handy command-line utility that can be used in bash shell scripts to both capture the current device names, and apply those names back to the right iPads. To ensure the command-line utility is installed, click the Apple Configurator 2 menu, and choose "Install Automation Tools...". Now to create the files you will need.

First, let's create a mapping of device ID to current name. Make sure all of the iPads you want to manage are connected. Open a Terminal window and run the following commands.

mkdir ~/Desktop/Rename
/usr/local/bin/cfgutil list | sed -e 's/.*ECID: 0x/0x/' | sed -e 's/[ ]*UDID: .*Name: /,/' >> ~/Desktop/Rename/ipad_lookup.txt

Note that is a tab between the [ ]. You cannot just hit the tab key in Terminal for a tab. You must first press CTRL+V, then the tab key.

This will create a CSV (comma separated values) text file with the device ID to name mapping in a folder called "Rename" on your desktop. Save this file (make a backup somewhere). You don't want to lose it. Open the file with a text editor to make sure all of the iPads are listed. You should only need to run this command once unless you add more iPads or decide to rename them.

Once you have the above file, you can safely run a Prepare job. After the Prepare job is done, you will need a script to rename the iPads. Rather than give full details about how to create a script here, I will simply refer you to another site describing the process. It isn't hard, and you just need to do this once. Simply follow the steps there, copying in the following lines into the script.

#!/bin/bash
WORKDIR=~/Desktop/Rename
/usr/local/bin/cfgutil list | sed -e 's/.*ECID: 0x/0x/' | sed -e 's/.UDID:.*//' > $WORKDIR/connected_iPads
while read ECID; do
  IPADNAME=`grep $ECID $WORKDIR/ipad_lookup.txt | sed -e 's/.*,//'`
  /usr/local/bin/cfgutil -e $ECID rename "$IPADNAME"
done < "$WORKDIR/connected_iPads"
rm $WORKDIR/connected_iPads

Make sure to save the script in the Rename folder on your desktop. I named the script file "renameConnectediPads.sh".

That script first detects all connected devices. For each connected device, it looks up the unique device ID in the previously created ipad_lookup.txt file, and renames the iPad accordingly. You can run this script while AC2 is running, and watch the names change as the script runs.

There you have it. Bash scripting is extremely powerful, and in just a few lines it solves one of the most annoying problems with AC2.

Deploying Shared iPads the New-Old Way

After spending a couple of weeks just getting more and more frustrated at the mess Apple has made with Configurator 2 (AC2) and Profile Manager (PM), I discovered a way to use Configurator 2 along with Configurator 1.7 (AC1) to get the results I am actually after.

In AC1, it was relatively easy to wipe devices by restoring from a backup. The iPads would get wiped, apps pushed back out over USB, and the devices renamed. AC1 had no trouble remembering whatever name had been previously assigned to the iPad, and re-applying that name during the restore process. The renaming part is one of the areas where AC2 seems to fail. It's like it forgets device names during the restore. This is very bad when you want the device name to match the uniquely numbered name printed on the device itself.

The biggest problem with the continued use of AC1 exclusively for the deployment of the iPads is that it does not support the ability to skip all of the "Welcome steps" of iOS9+ (the Setup Assistant), and there are a lot of steps now. Following a restore, it is necessary to manually skip through the steps of not setting a passcode, region, location services, and more. You have to do this on every iPad, so it is not realistic to continue using AC1 exclusively for managing the iPads.

Aside from the renaming problem in AC2, there seems to be a major problem with app deployment. First, the new app deployment mechanism in AC2 does not use the old method of downloading apps via iTunes and importing the .app file; it requires you to use "Managed Distribution" for all of your apps whether they are paid or free. If you want to deploy apps over USB during the restore process, you have to give AC2 the VPP Apple ID. When I did this, it reported that it was going to revoke the authority of PM to manage distribution of apps! I am assuming that this also means I would only be able to use this single computer to manage our apps, which is not possible across multiple sites.

The final piece that AC2 seems to break is that all of our iPads end up in the wrong timezone (and thus show the wrong time). I think restoring from a backup may deal with this, but I'm not sure.

It seems to be lose-lose, but it's not.

Note: For the following method, you must still have AC1 installed, or be able to install it. I'm not sure if you can still download it, but we still had it installed on our computer used to manage the iPads.

To start, make sure that all of the iPads you want to manage are prepared and supervised by AC1. Assign all device names using AC1. Once complete, quit AC1 and run AC2. In AC2, use the Migration tool to import all of the information from AC1. Once complete, you will be able to manage the iPads using both AC1 and AC2! If you add more devices later, you will need to add the new devices in AC1 and use the Migration tool again, but otherwise you just need to go through this process once.

When you need to wipe a shared device (or devices), follow these steps.

Run AC2 and connect all of the devices. Apply a blueprint that Prepares the iPads and applies profiles. The Prepare options are where you can disable the various iOS Welcom Screen (Setup Assistant) options. It will warn you that the connected devices are going to be erased. Just tell it to go ahead.

Once the process completes (takes about an hour for us), quit AC2 and run AC1. Select the iPads you have just restored and click Refresh. AC1 will push out any apps and profiles that are supposed to be on the devices, and it will rename the devices with the previously defined names!

Unplug the iPads and you will find that the Welcome steps have been skipped (well, those that can be skipped), your apps have been restored, and AC1 even sets the right timezone. If you've installed the PM management profile, you can even use it to push new profiles and apps remotely from PM later.

As far as I can tell, this is the best way to manage a collection of shared iPads that need to be regularly wiped. I would love to hear from others if they have found a better way.