Tiny Deathstars of Foulness

For many iOS deployment projects, iTunes is used as the primary deployment vehicle for the devices. iTunes can be used to “Backup” and “Restore” an iPad, similar to how you image desktop and laptop computers.

The actual deployment process is straight forward. First we’ll create a backup in iTunes. Then we can deploy the backup using the Restore option within iTunes. Provided the backup is encrypted, the Restore option will maintain the maximum amount of data available. For example, if a device has been activated then the fact that it has been activated is maintained across a restore. As are the applications that are installed on the device.

Create iTunes Backup

To Create an iTunes Backup:

  • Open iTunes and dock the device with the master configuration.
  • Check the box to “Encrypt local backup.”
  • At the Set Password screen, provide a password for the encrypted backup.
  • In order to ease restore, check the box for “Remember this password in my keychain (passwords are set to user names).
  • Control-click on the name of the device in the DEVICES section.
  • Click on “Back up”.
  • If prompted, click Set Password (subsequent backups will not require passwords).

Restoring with iTunes

To Restore an iTunes Backup:

  • Open iTunes and dock the device to be restored.
  • Control-click on the device.
  • Click “Restore from Backup”
  • At the “Restore From Backup” screen, select the name used in the previous backup.
  • Click Restore.
  • If prompted, enter the Password.
  • Rename the iPad once the restore process is complete.
  • Once the Restore is complete, if prompted to “Set Up Your iPad”, uncheck the Automatically sync songs and videos to my iPad box and “Automatically sync apps to my iPad”, putting the students Active Directory name in the Name field and clicking Done

August 9th, 2012

Posted In: iPhone, Mass Deployment

Tags: , , , , , , , , , , , ,

In a previous post I looked at automating iPhone and iPad deployment. There, we looked at the iPhone Configuration Utility. Now that Profile Manager is built into Mac OS X Server in Lion, and with the number of 3rd party MDM solutions on the market, many users of iPhone Configuration Utility are looking to extract information from it and move it into other places. Many of these places can import property lists.

If you look at the file header for .mobileconfig and .deviceinfo files you’ll notice that they begin with the familiar:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0"><dict>

Given that .mobileconfig and .deviceinfo files are property lists with different extensions, if you want to turn them into property lists, simply rename them. Given that many people will have 100s or 1000s of devices, this is something that most will want to automate. So, let’s use a basic for loop to do so. The following will convert .mobileconfig files into plist:

for x in ~/Library/MobileDevice/Configuration Profiles/*.mobileconfig; do mv $x `basename $x .mobileconfig`.plist; done;

This will put them back:

for x in ~/Library/MobileDevice/Configuration Profiles/*.plist; do mv $x `basename $x .plist`.mobileconfig; done;

Or to convert the device information to property lists:

for x in ~/Library/MobileDevice/Devices/*.deviceinfo; do mv $x `basename $x .deviceinfo`.plist; done;

Or property lists to device information:

for x in ~/Library/MobileDevice/Devices/*.plist; do mv $x `basename $x .plist`.deviceinfo; done;

Once files are converted then you can also automate crawling through them to obtain information. For example, to pull the information from the two fields in iPhone Configuration Utility that are user editable, ownerName and ownerEmail as well as the serial number of a device with a deviceIdentifier of 26c2d1b2a68c7862bd4c6bfbe708517964733cf3:

defaults read ~/Library/MobileDevice/Devices/26c2d1b2a68c7862bd4c6bfbe708517964733cf3 ownerEmail

defaults read ~/Library/MobileDevice/Devices/26c2d1b2a68c7862bd4c6bfbe708517964733cf3 ownerName

You could then redirect this output into a csv file, perhaps grabbing other information such as:

  • UniqueChipID
  • deviceActivationState
  • deviceBluetoothMACAddress
  • deviceBuildVersion
  • deviceCapacityKey
  • deviceClass
  • deviceIdentifier (also the basename of the file)
  • deviceLastConnected
  • deviceName
  • deviceProductVersion
  • deviceType
  • deviceWiFiMACAddress

And then there are 3 arrays that wouldn’t likely look great in a csv, but could easily be brought out automatically:

  • provisioningProfiles: useful if you are duplicating provisioning profile information into an mdm solution
  • configurationProfiles: useful if you are duplicating configuration profile information from devices into an mdm solution
  • applicationDictionaries: great for pulling off what apps are where

You can get all of this without moving the files to plist as well, but in this example I am making an assumption that you will be importing these devices via plist and so you would be converting them anyway. The ability to dump information into a csv for reporting or other types of imports is ancillary. Having said this, I’ve taken it all and wrapped it into a shell script:

echo deviceIdentifier,deviceSerialNumber,ownerName,ownerEmail,UniqueChipID,deviceActivationState,deviceBluetoothMACAddress,deviceBuildVersion,deviceCapacityKey,deviceClass,deviceLastConnected,deviceName,deviceProductVersion,deviceWiFiMACAddress,deviceType > ~/mydevices.csv
for deviceID in *.deviceinfo; do mv "$deviceID" "`basename "$deviceID" .deviceinfo`.plist";
deviceserialnumber=`defaults read ~/Library/MobileDevice/Devices/$deviceID deviceSerialNumber`
ownerName=`defaults read ~/Library/MobileDevice/Devices/$deviceID ownerName`
ownerEmail=`defaults read ~/Library/MobileDevice/Devices/$deviceID ownerEmail`
UniqueChipID=`defaults read ~/Library/MobileDevice/Devices/$deviceID UniqueChipID`
deviceActivationState=`defaults read ~/Library/MobileDevice/Devices/$deviceID deviceActivationState`
deviceBluetoothMACAddress=`defaults read ~/Library/MobileDevice/Devices/$deviceID deviceBluetoothMACAddress`
deviceBuildVersion=`defaults read ~/Library/MobileDevice/Devices/$deviceID deviceBuildVersion`
deviceCapacityKey=`defaults read ~/Library/MobileDevice/Devices/$deviceID deviceCapacityKey`
deviceClass=`defaults read ~/Library/MobileDevice/Devices/$deviceID deviceClass`
deviceLastConnected=`defaults read ~/Library/MobileDevice/Devices/$deviceID deviceLastConnected`
deviceName=`defaults read ~/Library/MobileDevice/Devices/$deviceID deviceName`
deviceProductVersion=`defaults read ~/Library/MobileDevice/Devices/$deviceID deviceProductVersion`
deviceType=`defaults read ~/Library/MobileDevice/Devices/$deviceID deviceType`
deviceWiFiMACAddress=`defaults read ~/Library/MobileDevice/Devices/$deviceID deviceWiFiMACAddress`
echo $deviceID,$deviceserialnumber,$ownerName,$ownerEmail,$UniqueChipID,$deviceActivationState,$deviceBluetoothMACAddress,$deviceBuildVersion,$deviceCapacityKey,$deviceClass,$deviceLastConnected,$deviceName,$deviceProductVersion,$deviceWiFiMACAddress,$deviceType >> ~/mydevices.csv

This script (which should have a bit more logic put into it for defining things, etc) should convert all of your .deviceinfo files to property list while building a csv of their contents (minus the arrays, which I didn’t think prudent to put into csv but which could be thrown in there pretty easily) in ~/mydevices.csv (or my devices.csv in your home directory). ProfileManager can definitely import device holders, which you should be able to do with a couple of columns of this output…

And to undo the conversion to plist (if you didn’t actually mean to do that part):

for x in ~/Library/MobileDevice/Devices/*.plist; do mv $x `basename $x .plist`.deviceinfo; done;

August 1st, 2011

Posted In: iPhone, Mac OS X, Mac OS X Server, Mac Security

Tags: , , , , , , , , , , ,