Difference between revisions of "ITunes"

From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search
(ITunes: error in package - dependent package name was wrong.)
(Undo revision 12919 by 50.205.69.250 (talk))
 
(40 intermediate revisions by 14 users not shown)
Line 1: Line 1:
 
= General Information =
 
= General Information =
Apple iTunes is primarily a program to play different types of media, but it is also required if you want to backup an IPhone or sync your emails, notes, bookmarks etc over USB with your PC. ITunes comes bundled with multiple sub programs that are all automatically installed when running the regular ITunes setup wizard. However depending on your use case you don't actually need all of them. Therefore this page is divided into two subparts: On the one hand a full blown ITunes installation (excluding Apple Software Update) when you actually want to use ITunes and Quicktime as an audio and video player, image viewer, podcast streamer, etc and on the other hand a minimal ITunes installation if you only want to use it to snc/backup an IPhone.
+
Apple iTunes is primarily a program to play different types of media, but it is also required if you want to backup an IPod/IPad/IPhone or sync your emails, notes, bookmarks etc over USB with your PC. ITunes comes bundled with multiple sub programs that are all automatically installed when running the regular ITunes setup wizard. However depending on your use case you don't actually need all of them. Therefore this page is divided into two subparts: On the one hand a full blown ITunes installation (excluding Apple Software Update) when you actually want to use ITunes as an audio and video player, podcast streamer, etc and on the other hand a minimal ITunes installation if you only want to use it to sync/backup mobile devices.
  
ITunes is one of the programs that are more difficult to package, since Apple is using it as a vehicle to distribute their other software. To get rid of at least some of those "extra" programs additional configuration steps are necessary to perform.
+
ITunes is one of the programs that are more difficult to package, since Apple is using it as a vehicle to distribute their other software. To get rid of at least some of those "extra" programs additional configuration steps are necessary to perform. Please read the instructions carefully, because some things here don't work as you would assume. Don't blindly copy and paste the XML code.
  
 
= Pre-Setup Process =
 
= Pre-Setup Process =
The ITunes installer consists of multiple MSI packages for each of its sub programs and a runtime that executes those MSI packages one after the other. To extract the MSI files do the following:
+
The iTunes installer consists of multiple MSI packages for each of its sub programs and a runtime that executes those MSI packages one after the other. To extract the MSI files do the following:
* Download the ITunes setup file from Apple (usually called iTunesSetup.exe)
+
* Download the ITunes setup file from [http://www.apple.com/itunes/download/ Apple]. The main download page attempts to guess what platform you're on and only offers you the correct download for that OS, but you can find direct download links for 32- and 64-bit packages from [https://discussions.apple.com/docs/DOC-6562#more this troubleshooting article].
* Open the file with 7zip or another file archiver
+
* Open the files with 7zip or another file archiver
* Extract iTunes.msi, QuickTime.msi, AppleApplicationSupport.msi and AppleMobileDeviceSupport.msi
+
** For 32-bit, download iTunesSetup.exe and extract iTunes.msi, AppleApplicationSupport.msi and AppleMobileDeviceSupport.msi
 +
** For 64-bit, download itunes6464setup.exe and extract iTunes6464.msi, AppleApplicationSupport.msi, AppleApplicationSupport64.msi and AppleMobileDeviceSupport6464.msi
 +
** If you have playback problems with 64-bit iTunes, download iTunes64Setup.exe and extract iTunes64.msi, AppleApplicationSupport64.msi and AppleMobileDeviceSupport64.msi
 +
 
 +
<source lang="php">
 +
<?php
 +
 
 +
# simple script to download and extract iTunes MSI packages
 +
# requires wget and 7z in %path%
 +
 
 +
$url = 'https://www.apple.com/itunes/download/';
 +
libxml_use_internal_errors(true);
 +
 
 +
$dom = new DOMDocument();
 +
$dom->loadHTML(download($url));
 +
$xpath = new DOMXPath($dom);
 +
$iframe = $xpath->query("//iframe");
 +
$iframe_url = $iframe->item(0)->getAttribute('src');
 +
 
 +
$dom->loadHTML(download($iframe_url));
 +
$xpath = new DOMXPath($dom);
 +
$downloads = $xpath->query("//input[@type='hidden']");
 +
 
 +
foreach ($downloads as $link) {
 +
$foo = $link->getAttribute("value");
 +
if(preg_match('/\.exe$/', $foo)){
 +
$filename = basename($foo);
 +
system("wget --no-check-certificate -O $filename $foo"); // XXX --no-check-certificate could be dangerous
 +
$dirname = preg_replace('/\.exe$/', '', $filename);
 +
if(!is_dir($dirname)){
 +
mkdir($dirname);
 +
}
 +
system("7z e -o$dirname $filename");
 +
}
 +
}
 +
 
 +
function download($url){
 +
$ch = curl_init();
 +
$timeout = 10;
 +
$useragent = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.65 Safari/537.36';
 +
$proxy = 'proxy.example.com:3128';
 +
curl_setopt($ch, CURLOPT_URL, $url);
 +
curl_setopt($ch, CURLOPT_PROXY, $proxy);
 +
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
 +
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
 +
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
 +
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 +
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
 +
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
 +
curl_setopt($ch,CURLOPT_ENCODING, '');
 +
$data = curl_exec($ch);
 +
curl_close($ch);
 +
return $data;
 +
}
 +
</source>
  
 
== Notes ==
 
== Notes ==
* Apple Mobile Device Support is only necessary if you want to connect an Ipod or IPhone. Quicktime and Apple Application Support are mandatory to be able to run ITunes.
+
* Starting with ITunes version 10.5, Quicktime is not part of the setup package anymore and also not necessary any longer to run ITunes. The installation instructions were therefore removed from this page.
 +
* Apple Mobile Device Support is only necessary if you want to connect an IPod, IPad or IPhone. Apple Application Support is mandatory to be able to run ITunes.
 
* Each sub-application has its own version. When a new version for ITunes comes out, you will need to extract the MSI packages from the EXE installer, right click on the MSI files and check their version to see which sub-applications have updated. Each sub-applications has its own WPKG package definition with separate install, upgrade and uninstall commands.
 
* Each sub-application has its own version. When a new version for ITunes comes out, you will need to extract the MSI packages from the EXE installer, right click on the MSI files and check their version to see which sub-applications have updated. Each sub-applications has its own WPKG package definition with separate install, upgrade and uninstall commands.
 
* To also get the latest available version of Apple Application Support you'll have to download every installer from the Apple website and check which one contains the latest version of the Apple Application Support.
 
* To also get the latest available version of Apple Application Support you'll have to download every installer from the Apple website and check which one contains the latest version of the Apple Application Support.
 
* Apple sometimes updates the MSI packages inside the EXE installer '''without''' changing the version number on the website. So do not take it for granted that there are no new packages available just because the version number on the website is still the same.
 
* Apple sometimes updates the MSI packages inside the EXE installer '''without''' changing the version number on the website. So do not take it for granted that there are no new packages available just because the version number on the website is still the same.
 
* Apple is also known to sometimes modify the setup packages of their programs even at minor version changes, so do not blindly assume that a new ITunes installer will work the same way as the old one did!
 
* Apple is also known to sometimes modify the setup packages of their programs even at minor version changes, so do not blindly assume that a new ITunes installer will work the same way as the old one did!
* '''Warning''': The version of Quicktime that is bundled with ITunes is '''not''' necessarily the newest version available and may contain known security flaws. For example ITunes 9.2.1.5 contained Quicktime 7.66, although Quicktime 7.67 had already been released since weeks at that time. Quicktime 7.66 has a highly critical security flaw that allows for remote execution of arbitrary code, simply by visiting a webpage ([http://secunia.com/advisories/40729 secunia.com]). If you encounter such a scenario, you will have to download the standalone Quicktime installer from Apple and extract the file QuickTime.msi from there. Alternatively you can use the minimal ITunes installation method below, which removes the Quicktime browser plugin and thereby mitigates the attack surface.
+
* There is a 64bit version of ITunes available too. As of version 11 the 64bit installer contains 64bit versions of ITunes itself and Apple Mobile Device Support and 32bit versions of Apple Application Support. The package definitions for the 64bit versions look basically the same as below, just the paths and GUIDs are different.
* There is a 64bit version of ITunes available too. As of version 10.1.2.17 the 64bit installer contains 64bit versions of ITunes itself and Apple Mobile Device Support and 32bit versions of Quicktime and Apple Application Support. The package definitions for the 64bit versions look basically the same as below, just the paths and GUIDs are different.
+
* Apple usually changes the GUIDs for every new release. This means that you need to perform a test install and check the GUIDs every time you deploy a new version unless you're willing to require that the original MSI be present to perform an uninstallation. One could potentially also write a script to check <code>HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products</code> and find the correct uninstall string for whatever version of each package is currently installed.
  
= Full ITunes installation 10.1.2.17 =
+
= iTunes 12.3.1.23 installation =
''If you update this code, please remember the GUIDs change on each new version installed!''
+
''If you update this code, please remember the uninstall GUIDs change with each new version!''
 +
 
 +
These package definitions provide a working installation of iTunes which allows you to activate, back up and sync an iPod, iPad or iPhone, install new iOS versions and get songs/apps from the Apple Store, but doesn't install Bonjour, doesn't create desktop shortcuts, doesn't use Apple Software Update, doesn't take over file associations and doesn't tamper with autorun settings.
 +
 
 +
This package is designed to uninstall cleanly even if you forget to update the GUIDs.
  
 
Deploy File/Folder Structure
 
Deploy File/Folder Structure
   %SOFTWARE%\itunes\iTunes.msi
+
   %SOFTWARE%\apple\iTunes-12.3.1.23\iTunes.msi
   %SOFTWARE%\itunes\QuickTime.msi
+
   %SOFTWARE%\apple\iTunes-12.3.1.23\iTunes6464.msi
   %SOFTWARE%\itunes\AppleMobileDeviceSupport.msi
+
   %SOFTWARE%\apple\iTunes-12.3.1.23\AppleMobileDeviceSupport.msi
   %SOFTWARE%\itunes\AppleApplicationSupport.msi
+
   %SOFTWARE%\apple\iTunes-12.3.1.23\AppleMobileDeviceSupport6464.msi
 +
  %SOFTWARE%\apple\iTunes-12.3.1.23\AppleApplicationSupport.msi
 +
  %SOFTWARE%\apple\iTunes-12.3.1.23\AppleApplicationSupport64.msi
  
 
<source lang="xml">
 
<source lang="xml">
 
<?xml version="1.0" encoding="UTF-8"?>
 
<?xml version="1.0" encoding="UTF-8"?>
<package id='appleapplicationsupport' name='Apple Application Support' revision='1.4.1' reboot='false' priority='1'>
+
<packages:packages
<check type='registry' condition='equals' path='HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{EE6097DD-05F4-4178-9719-D3170BF098E8}\DisplayVersion' value='1.4.1' />
+
        xmlns:packages="http://www.wpkg.org/packages" xmlns:wpkg="http://www.wpkg.org/wpkg" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 +
        xsi:schemaLocation="http://www.wpkg.org/packages ../xsd/packages.xsd" >
  
<install cmd='msiexec /i "%SOFTWARE%\itunes\AppleApplicationSupport.msi" /passive /norestart' timeout='300'>
+
<package
<exit code='0' />
+
  id="appleapplicationsupport"
<exit code='3010' reboot='postponed' />
+
  name="Apple Application Support"
</install>
+
  revision="%PKG_VERSION%"
+
  reboot="false"
 +
  priority="0">
  
<upgrade cmd='msiexec /i "%SOFTWARE%\itunes\AppleApplicationSupport.msi" /passive /norestart' timeout='300'>
+
<variable name="PKG_VERSION" value="4.1" />
<exit code='0' />
+
<variable name='ITUNES_VER' value="12.3.1.23" />
<exit code='3010' reboot='postponed' />
+
 
</upgrade>
+
<check type="logical" condition="and">
 +
  <check type="uninstall" condition="versiongreaterorequal" path="Apple Application Support (32-bit)" value="%PKG_VERSION%"  />  
 +
  <check type="uninstall" condition="versiongreaterorequal" path="Apple Application Support (64-bit)" value="%PKG_VERSION%" architecture="x64"  />  
 +
</check>
  
<remove cmd='msiexec /x{EE6097DD-05F4-4178-9719-D3170BF098E8} /passive /norestart' timeout='300'>
+
 
<exit code='0' />
+
<install cmd='msiexec /qn /i "%SOFTWARE%\Apple\iTunes-%ITUNES_VER%\AppleApplicationSupport.msi"'>
<exit code='1605' />
+
  <exit code="0" />
<exit code='3010' reboot='postponed' />
+
  <exit code="1638" />
</remove>
+
  <exit code="3010" />
 +
</install>
 +
<install cmd='msiexec /qn /i "%SOFTWARE%\Apple\iTunes-%ITUNES_VER%\AppleApplicationSupport64.msi"' architecture="x64">
 +
  <exit code="0" />  
 +
  <exit code="1638" />  
 +
  <exit code="3010" />
 +
</install>
 +
 
 +
 
 +
<upgrade include="install" />
 +
 
 +
<remove cmd="msiexec /qn /x {649a1fd9-5892-46ad-8df0-c4a43ff61cb7}">
 +
  <exit code="any" />
 +
</remove>
 +
<remove cmd="msiexec /qn /x {0de0a178-ac7b-4650-80c6-cf226de03766}" architecture="x64">
 +
  <exit code="any" />
 +
</remove>
 +
<remove cmd='msiexec /qn /x "%SOFTWARE%\Apple\iTunes-%ITUNES_VER%\AppleApplicationSupport.msi"'>
 +
  <exit code="any" />
 +
</remove>
 +
<remove cmd='msiexec /qn /x "%SOFTWARE%\Apple\iTunes-%ITUNES_VER%\AppleApplicationSupport64.msi"' architecture="x64">
 +
  <exit code="any" />
 +
</remove>
 
</package>
 
</package>
<package id='applemobilesupport' name='Apple Mobile Device Support' revision='3.3.1.3' reboot='false' priority='1'>
 
<check type='registry' condition='equals' path='HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5BF5F9C5-E95B-4AFA-94BE-F2A9CA73B61D}\DisplayVersion' value='3.3.0.69' />
 
  
<install cmd='msiexec /i "%SOFTWARE%\itunes\AppleMobileDeviceSupport.msi" /passive /norestart' timeout='300'>
 
<exit code='0' />
 
<exit code='3010' reboot='postponed' />
 
</install>
 
  
<upgrade cmd='msiexec /i "%SOFTWARE%\itunes\AppleMobileDeviceSupport.msi" /passive /norestart' timeout='300'>
+
<package id='applemobilesupport' name='Apple Mobile Device Support' revision='%PKGVER%' reboot='false' priority='10'>
<exit code='0' />
+
        <variable name='PKGVER' value='9.1.0.6' />
<exit code='3010' reboot='postponed' />
+
        <variable name='ITUNES_VER' value='12.3.1.23' />
</upgrade>
+
        <variable name="PKG_SOURCE" value='%SOFTWARE%\Apple\iTunes-%ITUNES_VER%\AppleMobileDeviceSupport.msi' architecture="x86" />
<remove cmd='msiexec /x {5BF5F9C5-E95B-4AFA-94BE-F2A9CA73B61D} /passive /norestart' timeout='300'>
+
        <variable name="PKG_SOURCE" value='%SOFTWARE%\Apple\iTunes-%ITUNES_VER%\AppleMobileDeviceSupport6464.msi' architecture="x64" />
<exit code='0' />
+
        <variable name="PRODUCT_ID" value='{9a629dcb-415d-4a50-85b9-5c2e4f8f74a8}' architecture="x86" />
<exit code='1605' />
+
        <variable name="PRODUCT_ID" value='{3540181e-340a-4e7a-b409-31663472b2f7}' architecture="x64" />
<exit code='3010' reboot='postponed' />
+
</remove>
+
        <check type='uninstall' condition='versiongreaterorequal' path='Apple Mobile Device Support' value='%PKGVER%' />
 +
 +
        <install cmd='msiexec /i "%PKG_SOURCE%" /passive /norestart' timeout='300'>
 +
                <exit code='0' />
 +
                <exit code='3010' reboot='postponed' />
 +
        </install>
 +
 +
        <upgrade include='install' />
 +
 +
        <remove cmd='msiexec /x%PRODUCT_ID% /passive /norestart' timeout='300'>        
 +
                <exit code='any' />
 +
        </remove>
 +
        <remove cmd='msiexec /x "%PKG_SOURCE%" /passive /norestart' timeout='300'>        
 +
                <exit code='any' />
 +
        </remove>
 
</package>
 
</package>
<package id='itunes' name='Apple iTunes' revision='10.1.2.17' reboot='false' priority='1'>
 
<depends package-id='appleapplicationsupport' />
 
<depends package-id='quicktime' />
 
  
<check type='uninstall' condition='exists' path='iTunes' />
+
<package id='itunes' name='Apple iTunes' revision='%PKGVER%' reboot='false' priority='9'>
<check type='file' condition='versiongreaterorequal' path='%PROGRAMFILES%\iTunes\iTunes.exe' value='10.1.2.17' />
+
        <depends package-id='appleapplicationsupport' />
+
        <depends package-id='applemobilesupport' />
<install cmd='msiexec.exe /i "%SOFTWARE%\itunes\iTunes.msi" SCHEDULE_ASUW=0 /passive /norestart' timeout='300'>
+
<exit code='0' />
+
        <variable name='PKGVER' value='12.3.1.23' />
<exit code='3010' reboot='postponed' />
+
        <variable name="PKG_SOURCE" value='%SOFTWARE%\Apple\iTunes-%PKGVER%\iTunes.msi' architecture="x86" />
</install>
+
        <variable name="PKG_SOURCE" value='%SOFTWARE%\Apple\iTunes-%PKGVER%\iTunes6464.msi' architecture="x64" />
<!-- Disable update feature in ITunes via parental controls -->
+
        <variable name="PRODUCT_ID" value='{8862f11a-a9a0-4899-9f50-b5a79f12f3c2}' architecture="x86" />  
<install cmd='reg add "HKLM\SOFTWARE\Apple Computer, Inc.\iTunes\Parental Controls\Default" /v "AdminFlags" /t REG_DWORD /d "0x101" /f' timeout='60' />
+
        <variable name="PRODUCT_ID" value='{e690a491-702f-4dec-9977-c015d1dbb57c}' architecture="x64" />  
+
<upgrade cmd='msiexec.exe /i "%SOFTWARE%\itunes\iTunes.msi" SCHEDULE_ASUW=0 /passive /norestart'>
+
        <check type='uninstall' condition='versiongreaterorequal' path='iTunes' value='%PKGVER%' />
<exit code='0' />
+
        <!-- Check if automatic updates have been disabled (value: 256) and settings have been locked (value: 1) -->
<exit code='3010' reboot='postponed' />
+
        <check type='registry' condition='equals' path='HKLM\SOFTWARE\Apple Computer, Inc.\iTunes\Parental Controls\Default\AdminFlags' value='257' />
</upgrade>
+
 
<upgrade cmd='reg add "HKLM\SOFTWARE\Apple Computer, Inc.\iTunes\Parental Controls\Default" /v "AdminFlags" /t REG_DWORD /d "0x101" /f' timeout='60' />
+
        <!--
+
          DESKTOP_SHORTCUTS=0: Don't create desktop shortcuts
<remove cmd='msiexec.exe /x{AAD47011-8518-4608-9656-951DA35B587B} /passive /norestart' timeout='300'>
+
          MEDIA_DEFAULTS=0: Don't make ITunes the default program for Audio CDs
<exit code='0' />
+
                            and various audio filetypes
<exit code='1605' />
+
          SCHEDULE_ASUW=0: Don't create a scheduled task to automatically
<exit code='3010' reboot='postponed' />
+
                          search for ITunes updates
</remove>
+
          REENABLEAUTORUN=0: Don't try to re-enable Windows autorun feature for CDs
</package>
+
          -->
<!-- Do not use version 7.68 which is bundled with ITunes 10.0.1.54 due to security flaws! -->
+
<package id='quicktime' name='Apple QuickTime' revision='7.69.80.9' reboot='false' priority='1'>
+
        <install cmd='msiexec.exe /i "%PKG_SOURCE%" DESKTOP_SHORTCUTS=0 MEDIA_DEFAULTS=0 SCHEDULE_ASUW=0 REENABLEAUTORUN=0 /passive' timeout='300'>
<check type='uninstall' condition='exists' path='QuickTime' />
+
                <exit code='0' />
<check type='file' condition='versiongreaterorequal' path='%PROGRAMFILES%\QuickTime\QuickTimePlayer.exe' value='7.69.80.9' />
+
                <!-- <exit code='3010' reboot='postponed' /> -->
+
        </install>
<install cmd='msiexec /i "%SOFTWARE%\itunes\QuickTime.msi" SCHEDULE_ASUW=0 /passive /norestart' timeout='300'>
+
 
<exit code='0' />
+
        <!-- Disable automatic update of ITunes via parental controls and lock
<exit code='3010' reboot='postponed' />
+
            the settings, see http://wpkg.org/iTunes more info -->
</install>
+
        <install cmd='reg add "HKLM\SOFTWARE\Apple Computer, Inc.\iTunes\Parental Controls\Default" /v "AdminFlags" /t REG_DWORD /d "0x101" /f' timeout='60' />
+
 
<upgrade cmd='msiexec /i "%SOFTWARE%\itunes\QuickTime.msi" SCHEDULE_ASUW=0 /passive /norestart' timeout='300'>
+
        <!-- Don't automatically load ITunes-Calendar-Addin for Outlook -->
<exit code='0' />
+
        <!-- This came from wpkg.org but probably won't actually work, since
<exit code='3010' reboot='postponed' />
+
            it uses HKCU  -->
</upgrade>
+
        <install cmd='reg add "HKCU\Software\Microsoft\Office\Outlook\Addins\iTunesAddIn.CalendarHelper" /v "LoadBehavior" /t REG_DWORD /d "0x0" /f' timeout='60' />
+
<remove cmd='msiexec /x{57752979-A1C9-4C02-856B-FBB27AC4E02C} /passive /norestart' timeout='300'>
+
        <upgrade include='install' />
<exit code='0' />
+
<exit code='1605' />
+
        <remove cmd='msiexec.exe /x%PRODUCT_ID% /passive /norestart' timeout='300'>
<exit code='3010' reboot='postponed' />
+
                <exit code='any' />
</remove>
+
        </remove>
 +
        <remove cmd='msiexec.exe /x "%PKG_SOURCE%" /passive /norestart' timeout='300'>
 +
                <exit code='any' />
 +
        </remove>
 +
 
 
</package>
 
</package>
 +
</packages>
 
</source>
 
</source>
  
= Minimal ITunes installation 10.1.2.17 =
+
= Minimal ITunes installation 11 =
The goal of this setup is to get  
+
The goal of this setup is to get a working installation of ITunes which allows you to activate, backup and sync an IPod, IPad or IPhone, install new iOS versions and optionally get songs/apps from the Apple Store, but does otherwise interfere with the PC as little as possible. Specifically this means: No automatic update checks, no desktop shortcuts, no automatic file type associations with ITunes, no ITunes CD grabbing, no unecessary background services or autostart entries, no traybar icons, no Windows firewall modifications.
# a working installation of ITunes which allows you to activate, backup and sync an IPhone or Ipod, download and install new iOS versions and optionally get songs/apps from the Apple Store,  
+
These package definitions are suited for someone who has to roll out ITunes in a corporate environment because the employees are using IPhones/IPads, but otherwise has no use case for ITunes at all. Of course all steps in this section are optional, if you don't want to leave a certain feature out, then simply omit the corresponding step.
# but does otherwise interfere with the PC as little as possible. Specifically this means: No Quicktime browser plugins, no Quicktime Java libraries, no automatic update checks, no desktop shortcuts, no automatic file type associations with Quicktime or ITunes, no ITunes CD grabbing, no unecessary background services, no autostart entries, no Quicktime picture viewer, no task icons.
+
These package definitions are suited for someone who has to roll out ITunes in a corporate environment because the employees are using IPhones, but otherwise has no use case for ITunes and/or Quicktime at all. Of course all steps in this section is optional, if you don't want to leave a certain feature out, then simply omit the corresponding step.
+
  
 
== Configuration ==
 
== Configuration ==
 
Not all necessary changes to the setup packages can be made at the command line level, therefore the MSI files have to be modified. For this the Microsoft tool ''Orca'' (freeware) is necessary. If you don't have Orca yet, download it from [http://support.microsoft.com/kb/255905/ Microsoft].
 
Not all necessary changes to the setup packages can be made at the command line level, therefore the MSI files have to be modified. For this the Microsoft tool ''Orca'' (freeware) is necessary. If you don't have Orca yet, download it from [http://support.microsoft.com/kb/255905/ Microsoft].
 +
 +
=== Apple Application Support ===
 +
* Open AppleApplicationSupport.msi, select ''New Transform'' from the main menu.
 +
* Drop the component ''APSDaemon.exe'' from the table ''FeatureComponents''. This prevents the wireless sync daemon from being installed and added to the Windows autostart.
 +
* Drop the action ''WixSchedFirewallExceptionsInstall'' from the table ''InstallExecuteSequence''. This prevents WebKit.dll being added as an internetwide exception to the Windows Firewall.
 +
* Click ''Generate Transform'' and save the resulting file into the same folder as the MSI.
 +
 +
=== Apple Mobile Device Support ===
 +
* Open AppleMobileDeviceSupport.msi, select ''New Transform'' from the main menu.
 +
* Drop the Component ''OutlookChangeNotifierAddIn.dll'' from the table ''FeatureComponents''. This removes the Outlook change notifier, which detects changes to contacts and calendards within Outlook. You don't need this if you sync the iPhone over the air via Activesync.
 +
* Click ''Generate Transform'' and save the resulting file into the same folder as the MSI.
  
 
=== ITunes ===
 
=== ITunes ===
 
* Open iTunes.msi, select ''New Transform'' from the main menu.
 
* Open iTunes.msi, select ''New Transform'' from the main menu.
 
* Drop the component ''itms.js'' from the table ''Component''. This file is responsible for registering ITunes as a trusted application in Firefox.
 
* Drop the component ''itms.js'' from the table ''Component''. This file is responsible for registering ITunes as a trusted application in Firefox.
* Drop the argument ''Launch_iTunesHelper'' in the table ''ControlEvent''. This prevents iTunesHelper.exe from being started after the setup finishes. ITunes Helper is responsible for automatically starting ITunes when an iPhone or iPod is being connected to the PC.
+
* Drop ''iTunesOutlookAddIn.dll'' from ''FeatureComponents'', so that the Outlook plugin does not get installed.
 +
* Drop the actions ''Launch_iTunesHelper'' and ''WixSchedFirewallExceptionsInstall'' from the table ''InstallExecuteSequence''. This prevents iTunesHelper.exe from being started after the setup finishes and ITunes.exe from being added as an internetwide exception to the Windows Firewall. ITunes Helper is responsible for automatically starting ITunes when an iPhone or iPod is being connected to the PC.
 
* Open the table ''Registry'' and drop the keys ''Registry415'' (adds iTunesHelper.exe to the Windows autorun) and ''Registry835'' to ''Registry843'' (adds the ITunes detector plugin to Firefox and other browsers). Of course the registry IDs may change in future ITunes versions, you can instead search for ''CurrentVersion\Run'' and ''MozillaPlugins'' in the column ''Key'' of the ''Registry'' table.
 
* Open the table ''Registry'' and drop the keys ''Registry415'' (adds iTunesHelper.exe to the Windows autorun) and ''Registry835'' to ''Registry843'' (adds the ITunes detector plugin to Firefox and other browsers). Of course the registry IDs may change in future ITunes versions, you can instead search for ''CurrentVersion\Run'' and ''MozillaPlugins'' in the column ''Key'' of the ''Registry'' table.
 
* Drop the file ''ITDetector.ocx'' from the table ''SelfReg''. This prevents the ITunes detector ActiveX component from being registered, which is otherwise added as a plugin to Internet Explorer.
 
* Drop the file ''ITDetector.ocx'' from the table ''SelfReg''. This prevents the ITunes detector ActiveX component from being registered, which is otherwise added as a plugin to Internet Explorer.
 
* Click ''Generate Transform'' and save the resulting file into the same folder as the MSI.
 
* Click ''Generate Transform'' and save the resulting file into the same folder as the MSI.
  
You can disable certain ITunes features via the registry. Apple has a list of almost everything that you can disable: [http://support.apple.com/kb/ht2102 How to manage iTunes control features] (kParentalFlags_DisablePing = 0x00800000 is missing in Apple's list). In the XML code below, only the update check in ITunes is disabled. If you want to disable other features too, look up their hexadecimal numbers at the above link, add them up and write the result as a DWORD value to ''HKLM\SOFTWARE\Apple Computer, Inc.\iTunes\Parental Controls\Default\AdminFlags''. Be aware that you always need to include the "Locked" flag (1) for the settings to take effect.
+
You can disable certain ITunes features via the registry. Apple has a list of almost everything that you can disable: [http://support.apple.com/kb/ht2102 How to manage iTunes control features]. In the XML code below, only the update check in ITunes is disabled. If you want to disable other features too, look up their hexadecimal numbers at the above link, add them up and write the result as a DWORD value to ''HKLM\SOFTWARE\Apple Computer, Inc.\iTunes\Parental Controls\Default\AdminFlags''. Be aware that you always need to include the "Locked" flag (1) for the settings to take effect. Also don't forget to change the <check> statement, if you modify the value in the registry.
 +
Be aware that disabling automatic updates in ITunes also stops the user from being able to download updates for Appstore apps in ITunes. Also ITunes does not recognize IPhones in DFU mode anymore. If the registry key for parental controls already exists in the HKCU hive, the ITunes seems to ignore the HKLM entries.
  
 
After ITunes is removed, it does not delete the files in ''%APPDATA%\Apple Computer\iTunes'', ''%USERPROFILE%\Local Settings\Application Data\Apple Computer\iTunes'' and ''%ALLUSERSPROFILE%\Anwendungsdaten\Apple Computer\iTunes''. If you want to remove those directories, you have to specify additional remove commands for WPKG. The same is true for the registry key ''HKCU\Software\Apple Computer, Inc.\iTunes''. The backups of IPhones, songs and applications from the Apple Store are stored outside of those directores!
 
After ITunes is removed, it does not delete the files in ''%APPDATA%\Apple Computer\iTunes'', ''%USERPROFILE%\Local Settings\Application Data\Apple Computer\iTunes'' and ''%ALLUSERSPROFILE%\Anwendungsdaten\Apple Computer\iTunes''. If you want to remove those directories, you have to specify additional remove commands for WPKG. The same is true for the registry key ''HKCU\Software\Apple Computer, Inc.\iTunes''. The backups of IPhones, songs and applications from the Apple Store are stored outside of those directores!
  
=== Quicktime ===
 
* Open QuickTime.msi with Orca, select ''New Transform'' from the main menu.
 
* Edit the table ''FeatureComponents'' and drop the component ''QuickTimeEssentials.qtx''. This gets rid of the installation of the Quicktime Firefox plugin. The rationale behind this is that the Quicktime plugin is of almost no use anymore because hardly anyone except Apple embeds Quicktime media files into websites. However nowadays one of the main attack vectors and primary source of drive-by installs are security holes in webbrowser plugins (for example ITunes 10.0 contained a Quicktime version that has two known and highly critical security holes [http://secunia.com/advisories/41123/ #1] [http://secunia.com/advisories/41213/ #2]). Therefore it is strongly advisable to install as few plugins as possible.
 
* Drop the condition ''NOT BNEWERPRODUCTISINSTALLED'' from the ''LaunchCondition'' table. This allows you the roll out the MSI via WPKG even if the user already installed a newer version of Quicktime manually.
 
* Click ''Generate Transform'' and save the resulting file into the same folder as the MSI.
 
 
Besides the periodic update checks via ''Apple Software Update'', Quicktime additionally performs update checks on its own when you launch it. To disable that behaviour install Quicktime on a test computer, delete the file ''%USERPROFILE%\Local Settings\Application Data\Apple Computer\QuickTime\QuickTime.qtp'' if it exists (adapt the path to your locale), then open the Quicktime settings in the Windows control panel, go to ''Update'', uncheck ''Check for updates automatically'' and click OK. Now copy the recreated file ''%USERPROFILE%\Local Settings\Application Data\Apple Computer\QuickTime\QuickTime.qtp'' (should be below 1kB) to ''%SOFTWARE%\itunes''. To deploy this file the package quicktimesettings is used. It copies ''QuickTime.qtp'' into ''%ALLUSERSPROFILE%\Application Data\Apple Computer\QuickTime'' and adds a registry key ''HKLM\SOFTWARE\Apple Computer, Inc.\QuickTime\LocalUserPreferences\FolderPath'' which points to this directory. '''Caution:''' Quicktime only checks that registry key if the key ''HKCU\SOFTWARE\Apple Computer, Inc.\QuickTime\LocalUserPreferences'' does not exist! If Quicktime is or was ever run without the HKLM-key present, it automatically creates the HKCU-key and then never checks the HKLM-key again.
 
 
After Quicktime is removed, it does not delete the files in ''%APPDATA%\Apple Computer\QuickTime'', ''%USERPROFILE%\Local Settings\Application Data\Apple Computer\QuickTime'' and ''%ALLUSERSPROFILE%\Application Data\Apple Computer\QuickTime''. If you want to remove those directories, you have to specify additional remove commands for WPKG. The same is true for the registry key ''HKCU\Software\Apple Computer, Inc.\QuickTime''.
 
  
 
== Package definitions ==
 
== Package definitions ==
=== Apple Application Support and Apple Mobile Device Support ===
+
=== Apple Application Support ===
Copy the package definitions from the full ITunes installation above and use the original MSI files as extracted from iTunesSetup.exe. These packages don't require any modifications.
+
 
+
=== ITunes ===
+
 
<source lang="xml">
 
<source lang="xml">
 
<?xml version="1.0" encoding="UTF-8"?>
 
<?xml version="1.0" encoding="UTF-8"?>
<package id='itunes' name='Apple iTunes' revision='10.1.2.17' reboot='false' priority='1'>
+
<package id='appleapplicationsupport' name='Apple Application Support' revision='%PKGVER%' reboot='false' priority='10'>
<depends package-id='appleapplicationsupport' />
+
<variable name='PKGVER' value='2.3.6' />
<depends package-id='quicktime' />
+
 
+
<check type='uninstall' condition='versiongreaterorequal' path='Apple Application Support' value='%PKGVER%'/>
<check type='uninstall' condition='exists' path='iTunes' />
+
<check type='file' condition='versiongreaterorequal' path='%PROGRAMFILES%\iTunes\iTunes.exe' value='10.1.2.17' />
+
<install cmd='msiexec /i "%SOFTWARE%\itunes\AppleApplicationSupport.msi" TRANSFORMS="%TEMP%\software\application-transform-from-above.mst" /passive /norestart' timeout='300'>
+
<!-- DESKTOP_SHORTCUTS=0: Don't create desktop shortcuts
+
MEDIA_DEFAULTS=0: Don't make ITunes the default program for Audio CDs and various audio filetypes
+
SCHEDULE_ASUW=0: Don't create a scheduled task to automatically search for ITunes updates
+
REENABLEAUTORUN=0: Don't try to re-enable Windows autorun feature for CDs
+
OUTLOOK_LOAD_BEHAVIOR=0: Don't load ITunes-Calendar-Addin in Outlook -->
+
<install cmd='msiexec.exe /i "%SOFTWARE%\itunes\iTunes.msi" TRANSFORMS="%SOFTWARE%\itunes\itunes-transform-from-above.mst" DESKTOP_SHORTCUTS=0 MEDIA_DEFAULTS=0 SCHEDULE_ASUW=0 REENABLEAUTORUN=0 OUTLOOK_LOAD_BEHAVIOR=0 /passive /norestart' timeout='300'>
+
 
<exit code='0' />
 
<exit code='0' />
 
<exit code='3010' reboot='postponed' />
 
<exit code='3010' reboot='postponed' />
 
</install>
 
</install>
<!-- Disable update feature in ITunes via parental controls -->
+
<install cmd='reg add "HKLM\SOFTWARE\Apple Computer, Inc.\iTunes\Parental Controls\Default" /v "AdminFlags" /t REG_DWORD /d "0x101" /f' timeout='60' />
+
<upgrade include='install' />
+
<upgrade cmd='msiexec.exe /i "%SOFTWARE%\itunes\iTunes.msi" TRANSFORMS="%SOFTWARE%\itunes\itunes-transform-from-above.mst" DESKTOP_SHORTCUTS=0 MEDIA_DEFAULTS=0 SCHEDULE_ASUW=0 REENABLEAUTORUN=0 OUTLOOK_LOAD_BEHAVIOR=0 /passive /norestart'>
+
<remove cmd='msiexec /x{78002155-f025-4070-85b3-7c0453561701} /passive /norestart' timeout='300'>
<exit code='0' />
+
<exit code='3010' reboot='postponed' />
+
</upgrade>
+
<upgrade cmd='reg add "HKLM\SOFTWARE\Apple Computer, Inc.\iTunes\Parental Controls\Default" /v "AdminFlags" /t REG_DWORD /d "0x101" /f' timeout='60' />
+
+
<remove cmd='msiexec.exe /x{AAD47011-8518-4608-9656-951DA35B587B} /passive /norestart' timeout='300'>
+
 
<exit code='0' />
 
<exit code='0' />
 
<exit code='1605' />
 
<exit code='1605' />
Line 188: Line 272:
 
</source>
 
</source>
  
=== Quicktime ===
+
=== Apple Mobile Device Support ===
The Quicktime installer package is grouped into multiple features (categories). For reasons that are left to the imagination of the reader, Apple prevents the user from deselecting any of those features through the GUI. However by using the ''ADDLOCAL'' switch, it is possible to specify which features should be installed. To use the audio and video playback capabilites of Quicktime, only the feature ''QuickTimeEssentials'' is necessary.
+
The other features as of version 7.69 are: QuickTimeInternet, QuickTimeImage, QuickTimeEffects, QuickTimeMusic, QuickTimeAuthoring, QuickTimeCapture, QuickTimeForJava, QuickTimeDiagnostics, QuickTimeProResDecoder. None of them is necessary to run ITunes, therefore they are all excluded. Be aware that ''QuickTimeInternet'' includes the Quicktime plugin for the Internet Explorer (see above for possible security implications when installing this feature).
+
 
+
 
<source lang="xml">
 
<source lang="xml">
 
<?xml version="1.0" encoding="UTF-8"?>
 
<?xml version="1.0" encoding="UTF-8"?>
<package id='quicktime' name='Apple QuickTime' revision='7.69.80.9' reboot='false' priority='1'>
+
<package id='applemobilesupport' name='Apple Mobile Device Support' revision='%PKGVER%' reboot='false' priority='10'>
<chain package-id='quicktimesettings' />
+
<variable name='PKGVER' value='7.0.0.117' />
+
        <variable name="PKG_SOURCE" value='%SOFTWARE%\itunes\AppleMobileDeviceSupport.msi' architecture="x86" />
<check type='uninstall' condition='exists' path='QuickTime' />
+
        <variable name="PKG_SOURCE" value='%SOFTWARE%\itunes\AppleMobileDeviceSupport64.msi' architecture="x64" />
<check type='file' condition='versiongreaterorequal' path='%PROGRAMFILES%\QuickTime\QuickTimePlayer.exe' value='7.69.80.9' />
+
        <variable name="PRODUCT_ID" value='{c0cc75cd-f5b7-46ad-b016-17c0f5171718}' architecture="x86" />
+
        <variable name="PRODUCT_ID" value='{b678797f-df38-4556-8a31-8b818e261868}' architecture="x64" />
<!-- ADDLOCAL=QuickTimeEssentials: Only install the main feature of Quicktime -->
+
 
<install cmd='msiexec /i "%SOFTWARE%\itunes\QuickTime.msi" TRANSFORMS="%SOFTWARE%\itunes\quicktime-transform-from-above.mst" ADDLOCAL=QuickTimeEssentials DESKTOP_SHORTCUTS=0 SCHEDULE_ASUW=0 /passive /norestart' timeout='300'>
+
 +
<check type='uninstall' condition='versiongreaterorequal' path='Apple Mobile Device Support' value='%PKGVER%' />
 +
 +
<install cmd='msiexec /i "%SOFTWARE%\itunes\AppleMobileDeviceSupport.msi" TRANSFORMS="%TEMP%\software\mobiledevice-transform-from-above.mst" /passive /norestart' timeout='300'>
 
<exit code='0' />
 
<exit code='0' />
 
<exit code='3010' reboot='postponed' />
 
<exit code='3010' reboot='postponed' />
 
</install>
 
</install>
+
<upgrade cmd='msiexec /i "%SOFTWARE%\itunes\QuickTime.msi" TRANSFORMS="%SOFTWARE%\itunes\quicktime-transform-from-above.mst" ADDLOCAL=QuickTimeEssentials DESKTOP_SHORTCUTS=0 SCHEDULE_ASUW=0 /passive /norestart' timeout='300'>
+
<upgrade include='install' />
 +
 +
<remove cmd='msiexec /x%PRODUCT_ID% /passive /norestart' timeout='300'>
 
<exit code='0' />
 
<exit code='0' />
 +
<exit code='1605' />
 
<exit code='3010' reboot='postponed' />
 
<exit code='3010' reboot='postponed' />
</upgrade>
+
</remove>
+
</package>
<remove cmd='msiexec /x{57752979-A1C9-4C02-856B-FBB27AC4E02C} /passive /norestart' timeout='300'>
+
</source>
 +
 
 +
=== ITunes ===
 +
<source lang="xml">
 +
<?xml version="1.0" encoding="UTF-8"?>
 +
<package id='itunes' name='Apple iTunes' revision='%PKGVER%' reboot='false' priority='1'>
 +
<depends package-id='appleapplicationsupport' />
 +
<depends package-id='applemobilesupport' />
 +
 +
<variable name='PKGVER' value='11.1.0.126' />
 +
<variable name="PKG_SOURCE" value='%SOFTWARE%\itunes\iTunes.msi' architecture="x86" />
 +
<variable name="PKG_SOURCE" value='%SOFTWARE%\itunes\iTunes64.msi' architecture="x64" />
 +
        <variable name="PRODUCT_ID" value='{f32dc846-4457-40a8-beca-bcc0e960bc53}' architecture="x86" />
 +
        <variable name="PRODUCT_ID" value='{f46aa0f1-e284-4878-a462-5f11b9166c0e}' architecture="x64" />
 +
 
 +
 +
<check type='uninstall' condition='versiongreaterorequal' path='iTunes' value='%PKGVER%' />
 +
<check type='registry' condition='equals' path='HKLM\SOFTWARE\Apple Computer, Inc.\iTunes\Parental Controls\Default\AdminFlags' value='257' />
 +
 +
<!-- DESKTOP_SHORTCUTS=0: Don't create desktop shortcuts
 +
MEDIA_DEFAULTS=0: Don't make ITunes the default program for Audio CDs and various audio filetypes
 +
SCHEDULE_ASUW=0: Don't create a scheduled task to automatically search for ITunes updates
 +
REENABLEAUTORUN=0: Don't try to re-enable Windows autorun feature for CDs -->
 +
<install cmd='msiexec.exe /i "%SOFTWARE%\itunes\iTunes.msi" TRANSFORMS="%SOFTWARE%\itunes\itunes-transform-from-above.mst" DESKTOP_SHORTCUTS=0 MEDIA_DEFAULTS=0 SCHEDULE_ASUW=0 REENABLEAUTORUN=0 /passive /norestart' timeout='300'>
 +
<exit code='0' />
 +
<exit code='3010' reboot='postponed' />
 +
</install>
 +
<!-- Disable update feature in ITunes via parental controls -->
 +
<install cmd='reg add "HKLM\SOFTWARE\Apple Computer, Inc.\iTunes\Parental Controls\Default" /v "AdminFlags" /t REG_DWORD /d "0x101" /f' timeout='60' />
 +
<!-- Don't automatically load ITunes-Calendar-Addin for Outlook -->
 +
<install cmd='reg add "HKCU\Software\Microsoft\Office\Outlook\Addins\iTunesAddIn.CalendarHelper" /v "LoadBehavior" /t REG_DWORD /d "0x0" /f' timeout='60' />
 +
 +
<upgrade include='install' />
 +
 +
<remove cmd='msiexec.exe /x%PRODUCT_ID% /passive /norestart' timeout='300'>
 
<exit code='0' />
 
<exit code='0' />
 
<exit code='1605' />
 
<exit code='1605' />
Line 218: Line 339:
 
</package>
 
</package>
  
<package id='quicktimesettings' name='Apple QuickTime settings' revision='1' notify='false' reboot='false' priority='1'>
+
</source>
<!-- Adapt the paths to your locale -->
+
<check type='registry' condition='equals' path='HKLM\SOFTWARE\Apple Computer, Inc.\QuickTime\LocalUserPreferences\FolderPath' value='C:\Documents and Settings\All Users\Application Data\Apple Computer\QuickTime\' />
+
<check type='file' condition='exists' path='%ALLUSERSPROFILE%\Application Data\Apple Computer\QuickTime\QuickTime.qtp' />
+
  
<install cmd='%COMSPEC% /C if exist "%ALLUSERSPROFILE%\Application Data" xcopy /y /v "%SOFTWARE%\itunes\QuickTime.qtp" "%ALLUSERSPROFILE%\Application Data\Apple Computer\QuickTime\"' timeout='60' />
+
= Full iTunes 10.4.0.80 installation in VBS =
<install cmd='%COMSPEC% /C if exist "%ALLUSERSPROFILE%\Application Data" reg.exe add "HKLM\SOFTWARE\Apple Computer, Inc.\QuickTime\LocalUserPreferences" /v "FolderPath" /d "%ALLUSERSPROFILE%\Application Data\Apple Computer\QuickTime\\" /f' timeout='60' />
+
  
<upgrade cmd='%COMSPEC% /C if exist "%ALLUSERSPROFILE%\Application Data" xcopy /y /v "%SOFTWARE%\itunes\QuickTime.qtp" "%ALLUSERSPROFILE%\Application Data\Apple Computer\QuickTime\"' timeout='60' />
+
<source lang="vb">
<upgrade cmd='%COMSPEC% /C if exist "%ALLUSERSPROFILE%\Application Data" reg.exe add "HKLM\SOFTWARE\Apple Computer, Inc.\QuickTime\LocalUserPreferences" /v "FolderPath" /d "%ALLUSERSPROFILE%\Application Data\Apple Computer\QuickTime\\" /f' timeout='60' />
+
' Directory folder %Software\iTunes, the script requires that the *.vbs file is located the same place as all *.msi files. If you have SCCM, you can distribute this script as a package.
  
<remove cmd='%COMSPEC% /C del "%ALLUSERSPROFILE%\Application Data\Apple Computer\QuickTime\QuickTime.qtp"' timeout='60'>
+
Set WshShell = WScript.CreateObject("WScript.Shell")
 +
Set objFSO = CreateObject("Scripting.FileSystemObject")
 +
strScriptFileDirectory = objFSO.GetParentFolderName(wscript.ScriptFullName)
 +
 
 +
' Create Transform for iTunes with orca or another msi editor, to make iTunes more "admin" friendly for distribution in company networks. A "how to" is described under the item iTunes.
 +
 
 +
WshShell.Run "msiexec /I AppleApplicationSupport.msi /q /norestart", 0, true
 +
WshShell.Run "msiexec /I Bonjour.msi /q /norestart", 0, true
 +
WshShell.Run "msiexec /I AppleMobileDeviceSupport.msi /q /norestart", 0, true
 +
WshShell.Run "msiexec /I itunes.msi TRANSFORMS=itunes.mst /q /norestart", 0, true
 +
WshShell.Run "msiexec /I quicktime.msi DESKTOP_SHORTCUTS=0 SCHEDULE_ASUW=0 REENABLEAUTORUN=0 /q /norestart", 0, true
 +
 
 +
' set parental controls, that disables "Run first welcome window", "Cannot change parental controls" and "No autoupdate"
 +
 
 +
Dim wshShell
 +
 
 +
Set wshShell = CreateObject( "WScript.Shell" )
 +
wshShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Apple Computer, Inc.\iTunes\Parental Controls\Default\AdminFlags", 16777473, "REG_DWORD"
 +
</source>
 +
 
 +
Copy this to notepad++ or another editor, save as *.vbs :-)
 +
 
 +
= Removing iTunes without GUIDs =
 +
 
 +
To avoid having to check the GUIDs every time you update this package, you can change the removal process to refer to the original MSIs. If you do this and later decide to remove iTunes from your site, you have to keep the installers in %SOFTWARE% until every computer has removed iTunes.
 +
 
 +
To do this, replace the remove stanzas with the following:
 +
 
 +
== Apple Application Support ==
 +
<source lang="xml">
 +
<remove cmd='msiexec /x %SOFTWARE%\itunes\AppleApplicationSupport.msi /passive /norestart' timeout='300'>
 +
                <!-- <exit code='any' /> --> <!-- uncomment to just rely on the check conditions -->
 
<exit code='0' />
 
<exit code='0' />
<exit code='1' />
+
<exit code='1605' />
 +
<exit code='3010' reboot='postponed' />
 
</remove>
 
</remove>
<remove cmd='reg.exe delete "HKLM\SOFTWARE\Apple Computer, Inc.\QuickTime\LocalUserPreferences" /f' timeout='60'>
+
</source>
 +
 
 +
== Apple Mobile Device Support ==
 +
<source lang="xml">
 +
        <remove cmd='msiexec /x "%PKG_SOURCE%" /passive /norestart' timeout='300'>   
 +
                <!-- <exit code='any' /> --> <!-- uncomment to just rely on the check conditions -->
 
<exit code='0' />
 
<exit code='0' />
<exit code='1' />
+
<exit code='1605' />
</remove>
+
<exit code='3010' reboot='postponed' />
</package>
+
        </remove>
 +
</source>
  
 +
== iTunes ==
 +
<source lang="xml">
 +
        <remove cmd='msiexec.exe /x "%PKG_SOURCE%" /passive /norestart' timeout='300'>
 +
                <!-- <exit code='any' /> --> <!-- uncomment to just rely on the check conditions -->
 +
                <exit code='0' />
 +
                <exit code='1605' />
 +
                <!-- <exit code='3010' reboot='postponed' /> -->
 +
        </remove>
 
</source>
 
</source>
  
 
[[Category:Silent Installers]]
 
[[Category:Silent Installers]]

Latest revision as of 14:40, 5 November 2016

General Information

Apple iTunes is primarily a program to play different types of media, but it is also required if you want to backup an IPod/IPad/IPhone or sync your emails, notes, bookmarks etc over USB with your PC. ITunes comes bundled with multiple sub programs that are all automatically installed when running the regular ITunes setup wizard. However depending on your use case you don't actually need all of them. Therefore this page is divided into two subparts: On the one hand a full blown ITunes installation (excluding Apple Software Update) when you actually want to use ITunes as an audio and video player, podcast streamer, etc and on the other hand a minimal ITunes installation if you only want to use it to sync/backup mobile devices.

ITunes is one of the programs that are more difficult to package, since Apple is using it as a vehicle to distribute their other software. To get rid of at least some of those "extra" programs additional configuration steps are necessary to perform. Please read the instructions carefully, because some things here don't work as you would assume. Don't blindly copy and paste the XML code.

Pre-Setup Process

The iTunes installer consists of multiple MSI packages for each of its sub programs and a runtime that executes those MSI packages one after the other. To extract the MSI files do the following:

  • Download the ITunes setup file from Apple. The main download page attempts to guess what platform you're on and only offers you the correct download for that OS, but you can find direct download links for 32- and 64-bit packages from this troubleshooting article.
  • Open the files with 7zip or another file archiver
    • For 32-bit, download iTunesSetup.exe and extract iTunes.msi, AppleApplicationSupport.msi and AppleMobileDeviceSupport.msi
    • For 64-bit, download itunes6464setup.exe and extract iTunes6464.msi, AppleApplicationSupport.msi, AppleApplicationSupport64.msi and AppleMobileDeviceSupport6464.msi
    • If you have playback problems with 64-bit iTunes, download iTunes64Setup.exe and extract iTunes64.msi, AppleApplicationSupport64.msi and AppleMobileDeviceSupport64.msi
<?php

# simple script to download and extract iTunes MSI packages
# requires wget and 7z in %path%

$url = 'https://www.apple.com/itunes/download/';
libxml_use_internal_errors(true);

$dom = new DOMDocument();
$dom->loadHTML(download($url));
$xpath = new DOMXPath($dom);
$iframe = $xpath->query("//iframe");
$iframe_url = $iframe->item(0)->getAttribute('src');

$dom->loadHTML(download($iframe_url));
$xpath = new DOMXPath($dom);
$downloads = $xpath->query("//input[@type='hidden']");

foreach ($downloads as $link) {
	$foo = $link->getAttribute("value");
	if(preg_match('/\.exe$/', $foo)){
		$filename = basename($foo);
		system("wget --no-check-certificate -O $filename $foo"); // XXX --no-check-certificate could be dangerous
		$dirname = preg_replace('/\.exe$/', '', $filename);
		if(!is_dir($dirname)){
			mkdir($dirname);
		}
		system("7z e -o$dirname $filename");
	}
}

function download($url){
	$ch = curl_init();
	$timeout = 10;
	$useragent = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.65 Safari/537.36';
	$proxy = 'proxy.example.com:3128';
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_PROXY, $proxy);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
	curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
	curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
	curl_setopt($ch,CURLOPT_ENCODING, '');
	$data = curl_exec($ch);
	curl_close($ch);
	return $data;
}

Notes

  • Starting with ITunes version 10.5, Quicktime is not part of the setup package anymore and also not necessary any longer to run ITunes. The installation instructions were therefore removed from this page.
  • Apple Mobile Device Support is only necessary if you want to connect an IPod, IPad or IPhone. Apple Application Support is mandatory to be able to run ITunes.
  • Each sub-application has its own version. When a new version for ITunes comes out, you will need to extract the MSI packages from the EXE installer, right click on the MSI files and check their version to see which sub-applications have updated. Each sub-applications has its own WPKG package definition with separate install, upgrade and uninstall commands.
  • To also get the latest available version of Apple Application Support you'll have to download every installer from the Apple website and check which one contains the latest version of the Apple Application Support.
  • Apple sometimes updates the MSI packages inside the EXE installer without changing the version number on the website. So do not take it for granted that there are no new packages available just because the version number on the website is still the same.
  • Apple is also known to sometimes modify the setup packages of their programs even at minor version changes, so do not blindly assume that a new ITunes installer will work the same way as the old one did!
  • There is a 64bit version of ITunes available too. As of version 11 the 64bit installer contains 64bit versions of ITunes itself and Apple Mobile Device Support and 32bit versions of Apple Application Support. The package definitions for the 64bit versions look basically the same as below, just the paths and GUIDs are different.
  • Apple usually changes the GUIDs for every new release. This means that you need to perform a test install and check the GUIDs every time you deploy a new version unless you're willing to require that the original MSI be present to perform an uninstallation. One could potentially also write a script to check HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products and find the correct uninstall string for whatever version of each package is currently installed.

iTunes 12.3.1.23 installation

If you update this code, please remember the uninstall GUIDs change with each new version!

These package definitions provide a working installation of iTunes which allows you to activate, back up and sync an iPod, iPad or iPhone, install new iOS versions and get songs/apps from the Apple Store, but doesn't install Bonjour, doesn't create desktop shortcuts, doesn't use Apple Software Update, doesn't take over file associations and doesn't tamper with autorun settings.

This package is designed to uninstall cleanly even if you forget to update the GUIDs.

Deploy File/Folder Structure

 %SOFTWARE%\apple\iTunes-12.3.1.23\iTunes.msi
 %SOFTWARE%\apple\iTunes-12.3.1.23\iTunes6464.msi
 %SOFTWARE%\apple\iTunes-12.3.1.23\AppleMobileDeviceSupport.msi
 %SOFTWARE%\apple\iTunes-12.3.1.23\AppleMobileDeviceSupport6464.msi
 %SOFTWARE%\apple\iTunes-12.3.1.23\AppleApplicationSupport.msi
 %SOFTWARE%\apple\iTunes-12.3.1.23\AppleApplicationSupport64.msi
<?xml version="1.0" encoding="UTF-8"?>
<packages:packages
        xmlns:packages="http://www.wpkg.org/packages" xmlns:wpkg="http://www.wpkg.org/wpkg" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.wpkg.org/packages ../xsd/packages.xsd" >

<package
   id="appleapplicationsupport"
   name="Apple Application Support"
   revision="%PKG_VERSION%"
   reboot="false"
   priority="0">

 <variable name="PKG_VERSION" value="4.1" />
 <variable name='ITUNES_VER' value="12.3.1.23" />

 <check type="logical" condition="and">
   <check type="uninstall" condition="versiongreaterorequal" path="Apple Application Support (32-bit)" value="%PKG_VERSION%"  /> 
   <check type="uninstall" condition="versiongreaterorequal" path="Apple Application Support (64-bit)" value="%PKG_VERSION%" architecture="x64"  /> 
 </check>


 <install cmd='msiexec /qn /i "%SOFTWARE%\Apple\iTunes-%ITUNES_VER%\AppleApplicationSupport.msi"'>
   <exit code="0" /> 
   <exit code="1638" /> 
   <exit code="3010" /> 
 </install>
 <install cmd='msiexec /qn /i "%SOFTWARE%\Apple\iTunes-%ITUNES_VER%\AppleApplicationSupport64.msi"' architecture="x64">
   <exit code="0" /> 
   <exit code="1638" /> 
   <exit code="3010" /> 
 </install>


 <upgrade include="install" />

 <remove cmd="msiexec /qn /x {649a1fd9-5892-46ad-8df0-c4a43ff61cb7}">
   <exit code="any" />
 </remove>
 <remove cmd="msiexec /qn /x {0de0a178-ac7b-4650-80c6-cf226de03766}" architecture="x64">
   <exit code="any" />
 </remove>
 <remove cmd='msiexec /qn /x "%SOFTWARE%\Apple\iTunes-%ITUNES_VER%\AppleApplicationSupport.msi"'>
   <exit code="any" />
 </remove>
 <remove cmd='msiexec /qn /x "%SOFTWARE%\Apple\iTunes-%ITUNES_VER%\AppleApplicationSupport64.msi"' architecture="x64">
   <exit code="any" />
 </remove>
</package>


<package id='applemobilesupport' name='Apple Mobile Device Support' revision='%PKGVER%' reboot='false' priority='10'>
        <variable name='PKGVER' value='9.1.0.6' />
        <variable name='ITUNES_VER' value='12.3.1.23' />
        <variable name="PKG_SOURCE" value='%SOFTWARE%\Apple\iTunes-%ITUNES_VER%\AppleMobileDeviceSupport.msi' architecture="x86" /> 
        <variable name="PKG_SOURCE" value='%SOFTWARE%\Apple\iTunes-%ITUNES_VER%\AppleMobileDeviceSupport6464.msi' architecture="x64" /> 
        <variable name="PRODUCT_ID" value='{9a629dcb-415d-4a50-85b9-5c2e4f8f74a8}' architecture="x86" /> 
        <variable name="PRODUCT_ID" value='{3540181e-340a-4e7a-b409-31663472b2f7}' architecture="x64" /> 
 
        <check type='uninstall' condition='versiongreaterorequal' path='Apple Mobile Device Support' value='%PKGVER%' />
 
        <install cmd='msiexec /i "%PKG_SOURCE%" /passive /norestart' timeout='300'>
                <exit code='0' />
                <exit code='3010' reboot='postponed' />
        </install>
 
        <upgrade include='install' />
 
        <remove cmd='msiexec /x%PRODUCT_ID% /passive /norestart' timeout='300'>         
                <exit code='any' />
        </remove>
        <remove cmd='msiexec /x "%PKG_SOURCE%" /passive /norestart' timeout='300'>         
                <exit code='any' />
        </remove>
</package>

<package id='itunes' name='Apple iTunes' revision='%PKGVER%' reboot='false' priority='9'>
        <depends package-id='appleapplicationsupport' />
        <depends package-id='applemobilesupport' />
 
        <variable name='PKGVER' value='12.3.1.23' />
        <variable name="PKG_SOURCE" value='%SOFTWARE%\Apple\iTunes-%PKGVER%\iTunes.msi' architecture="x86" /> 
        <variable name="PKG_SOURCE" value='%SOFTWARE%\Apple\iTunes-%PKGVER%\iTunes6464.msi' architecture="x64" /> 
        <variable name="PRODUCT_ID" value='{8862f11a-a9a0-4899-9f50-b5a79f12f3c2}' architecture="x86" /> 
        <variable name="PRODUCT_ID" value='{e690a491-702f-4dec-9977-c015d1dbb57c}' architecture="x64" /> 
 
        <check type='uninstall' condition='versiongreaterorequal' path='iTunes' value='%PKGVER%' />
        <!-- Check if automatic updates have been disabled (value: 256) and settings have been locked (value: 1) -->
        <check type='registry' condition='equals' path='HKLM\SOFTWARE\Apple Computer, Inc.\iTunes\Parental Controls\Default\AdminFlags' value='257' />

        <!--
          DESKTOP_SHORTCUTS=0: Don't create desktop shortcuts
          MEDIA_DEFAULTS=0: Don't make ITunes the default program for Audio CDs
                            and various audio filetypes
          SCHEDULE_ASUW=0: Don't create a scheduled task to automatically
                           search for ITunes updates
          REENABLEAUTORUN=0: Don't try to re-enable Windows autorun feature for CDs
          -->
 
        <install cmd='msiexec.exe /i "%PKG_SOURCE%" DESKTOP_SHORTCUTS=0 MEDIA_DEFAULTS=0 SCHEDULE_ASUW=0 REENABLEAUTORUN=0 /passive' timeout='300'>
                <exit code='0' />
                <!-- <exit code='3010' reboot='postponed' /> -->
        </install>

        <!-- Disable automatic update of ITunes via parental controls and lock
             the settings, see http://wpkg.org/iTunes more info -->
        <install cmd='reg add "HKLM\SOFTWARE\Apple Computer, Inc.\iTunes\Parental Controls\Default" /v "AdminFlags" /t REG_DWORD /d "0x101" /f' timeout='60' />

        <!-- Don't automatically load ITunes-Calendar-Addin for Outlook -->
        <!-- This came from wpkg.org but probably won't actually work, since
             it uses HKCU  -->
        <install cmd='reg add "HKCU\Software\Microsoft\Office\Outlook\Addins\iTunesAddIn.CalendarHelper" /v "LoadBehavior" /t REG_DWORD /d "0x0" /f' timeout='60' />
 
        <upgrade include='install' />
 
        <remove cmd='msiexec.exe /x%PRODUCT_ID% /passive /norestart' timeout='300'>
                <exit code='any' />
        </remove>
        <remove cmd='msiexec.exe /x "%PKG_SOURCE%" /passive /norestart' timeout='300'>
                <exit code='any' />
        </remove>

</package>
</packages>

Minimal ITunes installation 11

The goal of this setup is to get a working installation of ITunes which allows you to activate, backup and sync an IPod, IPad or IPhone, install new iOS versions and optionally get songs/apps from the Apple Store, but does otherwise interfere with the PC as little as possible. Specifically this means: No automatic update checks, no desktop shortcuts, no automatic file type associations with ITunes, no ITunes CD grabbing, no unecessary background services or autostart entries, no traybar icons, no Windows firewall modifications. These package definitions are suited for someone who has to roll out ITunes in a corporate environment because the employees are using IPhones/IPads, but otherwise has no use case for ITunes at all. Of course all steps in this section are optional, if you don't want to leave a certain feature out, then simply omit the corresponding step.

Configuration

Not all necessary changes to the setup packages can be made at the command line level, therefore the MSI files have to be modified. For this the Microsoft tool Orca (freeware) is necessary. If you don't have Orca yet, download it from Microsoft.

Apple Application Support

  • Open AppleApplicationSupport.msi, select New Transform from the main menu.
  • Drop the component APSDaemon.exe from the table FeatureComponents. This prevents the wireless sync daemon from being installed and added to the Windows autostart.
  • Drop the action WixSchedFirewallExceptionsInstall from the table InstallExecuteSequence. This prevents WebKit.dll being added as an internetwide exception to the Windows Firewall.
  • Click Generate Transform and save the resulting file into the same folder as the MSI.

Apple Mobile Device Support

  • Open AppleMobileDeviceSupport.msi, select New Transform from the main menu.
  • Drop the Component OutlookChangeNotifierAddIn.dll from the table FeatureComponents. This removes the Outlook change notifier, which detects changes to contacts and calendards within Outlook. You don't need this if you sync the iPhone over the air via Activesync.
  • Click Generate Transform and save the resulting file into the same folder as the MSI.

ITunes

  • Open iTunes.msi, select New Transform from the main menu.
  • Drop the component itms.js from the table Component. This file is responsible for registering ITunes as a trusted application in Firefox.
  • Drop iTunesOutlookAddIn.dll from FeatureComponents, so that the Outlook plugin does not get installed.
  • Drop the actions Launch_iTunesHelper and WixSchedFirewallExceptionsInstall from the table InstallExecuteSequence. This prevents iTunesHelper.exe from being started after the setup finishes and ITunes.exe from being added as an internetwide exception to the Windows Firewall. ITunes Helper is responsible for automatically starting ITunes when an iPhone or iPod is being connected to the PC.
  • Open the table Registry and drop the keys Registry415 (adds iTunesHelper.exe to the Windows autorun) and Registry835 to Registry843 (adds the ITunes detector plugin to Firefox and other browsers). Of course the registry IDs may change in future ITunes versions, you can instead search for CurrentVersion\Run and MozillaPlugins in the column Key of the Registry table.
  • Drop the file ITDetector.ocx from the table SelfReg. This prevents the ITunes detector ActiveX component from being registered, which is otherwise added as a plugin to Internet Explorer.
  • Click Generate Transform and save the resulting file into the same folder as the MSI.

You can disable certain ITunes features via the registry. Apple has a list of almost everything that you can disable: How to manage iTunes control features. In the XML code below, only the update check in ITunes is disabled. If you want to disable other features too, look up their hexadecimal numbers at the above link, add them up and write the result as a DWORD value to HKLM\SOFTWARE\Apple Computer, Inc.\iTunes\Parental Controls\Default\AdminFlags. Be aware that you always need to include the "Locked" flag (1) for the settings to take effect. Also don't forget to change the <check> statement, if you modify the value in the registry. Be aware that disabling automatic updates in ITunes also stops the user from being able to download updates for Appstore apps in ITunes. Also ITunes does not recognize IPhones in DFU mode anymore. If the registry key for parental controls already exists in the HKCU hive, the ITunes seems to ignore the HKLM entries.

After ITunes is removed, it does not delete the files in %APPDATA%\Apple Computer\iTunes, %USERPROFILE%\Local Settings\Application Data\Apple Computer\iTunes and %ALLUSERSPROFILE%\Anwendungsdaten\Apple Computer\iTunes. If you want to remove those directories, you have to specify additional remove commands for WPKG. The same is true for the registry key HKCU\Software\Apple Computer, Inc.\iTunes. The backups of IPhones, songs and applications from the Apple Store are stored outside of those directores!


Package definitions

Apple Application Support

<?xml version="1.0" encoding="UTF-8"?>
<package id='appleapplicationsupport' name='Apple Application Support' revision='%PKGVER%' reboot='false' priority='10'>
	<variable name='PKGVER' value='2.3.6' />
 
	<check type='uninstall' condition='versiongreaterorequal' path='Apple Application Support' value='%PKGVER%'/>
 
	<install cmd='msiexec /i "%SOFTWARE%\itunes\AppleApplicationSupport.msi" TRANSFORMS="%TEMP%\software\application-transform-from-above.mst" /passive /norestart' timeout='300'>
		<exit code='0' />
		<exit code='3010' reboot='postponed' />
	</install>
 
	<upgrade include='install' />
 
	<remove cmd='msiexec /x{78002155-f025-4070-85b3-7c0453561701} /passive /norestart' timeout='300'>
		<exit code='0' />
		<exit code='1605' />
		<exit code='3010' reboot='postponed' />
	</remove>
</package>

Apple Mobile Device Support

<?xml version="1.0" encoding="UTF-8"?>
<package id='applemobilesupport' name='Apple Mobile Device Support' revision='%PKGVER%' reboot='false' priority='10'>
	<variable name='PKGVER' value='7.0.0.117' />
        <variable name="PKG_SOURCE" value='%SOFTWARE%\itunes\AppleMobileDeviceSupport.msi' architecture="x86" /> 
        <variable name="PKG_SOURCE" value='%SOFTWARE%\itunes\AppleMobileDeviceSupport64.msi' architecture="x64" /> 
        <variable name="PRODUCT_ID" value='{c0cc75cd-f5b7-46ad-b016-17c0f5171718}' architecture="x86" />
        <variable name="PRODUCT_ID" value='{b678797f-df38-4556-8a31-8b818e261868}' architecture="x64" />

 
	<check type='uninstall' condition='versiongreaterorequal' path='Apple Mobile Device Support' value='%PKGVER%' />
 
	<install cmd='msiexec /i "%SOFTWARE%\itunes\AppleMobileDeviceSupport.msi" TRANSFORMS="%TEMP%\software\mobiledevice-transform-from-above.mst" /passive /norestart' timeout='300'>
		<exit code='0' />
		<exit code='3010' reboot='postponed' />
	</install>
 
	<upgrade include='install' />
 
	<remove cmd='msiexec /x%PRODUCT_ID% /passive /norestart' timeout='300'>		
		<exit code='0' />
		<exit code='1605' />
		<exit code='3010' reboot='postponed' />
	</remove>
</package>

ITunes

<?xml version="1.0" encoding="UTF-8"?>
<package id='itunes' name='Apple iTunes' revision='%PKGVER%' reboot='false' priority='1'>
	<depends package-id='appleapplicationsupport' />
	<depends package-id='applemobilesupport' />
 
	<variable name='PKGVER' value='11.1.0.126' />
	<variable name="PKG_SOURCE" value='%SOFTWARE%\itunes\iTunes.msi' architecture="x86" /> 
	<variable name="PKG_SOURCE" value='%SOFTWARE%\itunes\iTunes64.msi' architecture="x64" /> 
        <variable name="PRODUCT_ID" value='{f32dc846-4457-40a8-beca-bcc0e960bc53}' architecture="x86" />
        <variable name="PRODUCT_ID" value='{f46aa0f1-e284-4878-a462-5f11b9166c0e}' architecture="x64" />

 
	<check type='uninstall' condition='versiongreaterorequal' path='iTunes' value='%PKGVER%' />
	<check type='registry' condition='equals' path='HKLM\SOFTWARE\Apple Computer, Inc.\iTunes\Parental Controls\Default\AdminFlags' value='257' />
 
	<!-- DESKTOP_SHORTCUTS=0: Don't create desktop shortcuts
	MEDIA_DEFAULTS=0: Don't make ITunes the default program for Audio CDs and various audio filetypes
	SCHEDULE_ASUW=0: Don't create a scheduled task to automatically search for ITunes updates
	REENABLEAUTORUN=0: Don't try to re-enable Windows autorun feature for CDs -->
	<install cmd='msiexec.exe /i "%SOFTWARE%\itunes\iTunes.msi" TRANSFORMS="%SOFTWARE%\itunes\itunes-transform-from-above.mst" DESKTOP_SHORTCUTS=0 MEDIA_DEFAULTS=0 SCHEDULE_ASUW=0 REENABLEAUTORUN=0 /passive /norestart' timeout='300'>
		<exit code='0' />
		<exit code='3010' reboot='postponed' />
	</install>
	<!-- Disable update feature in ITunes via parental controls -->
	<install cmd='reg add "HKLM\SOFTWARE\Apple Computer, Inc.\iTunes\Parental Controls\Default" /v "AdminFlags" /t REG_DWORD /d "0x101" /f' timeout='60' />
	<!-- Don't automatically load ITunes-Calendar-Addin for Outlook -->
	<install cmd='reg add "HKCU\Software\Microsoft\Office\Outlook\Addins\iTunesAddIn.CalendarHelper" /v "LoadBehavior" /t REG_DWORD /d "0x0" /f' timeout='60' />
 
	<upgrade include='install' />
 
	<remove cmd='msiexec.exe /x%PRODUCT_ID% /passive /norestart' timeout='300'>
		<exit code='0' />
		<exit code='1605' />
		<exit code='3010' reboot='postponed' />
	</remove>
</package>

Full iTunes 10.4.0.80 installation in VBS

' Directory folder %Software\iTunes, the script requires that the *.vbs file is located the same place as all *.msi files. If you have SCCM, you can distribute this script as a package.

 Set WshShell = WScript.CreateObject("WScript.Shell") 
 Set objFSO = CreateObject("Scripting.FileSystemObject") 
 strScriptFileDirectory = objFSO.GetParentFolderName(wscript.ScriptFullName) 

' Create Transform for iTunes with orca or another msi editor, to make iTunes more "admin" friendly for distribution in company networks. A "how to" is described under the item iTunes.

 WshShell.Run "msiexec /I AppleApplicationSupport.msi /q /norestart", 0, true
 WshShell.Run "msiexec /I Bonjour.msi /q /norestart", 0, true
 WshShell.Run "msiexec /I AppleMobileDeviceSupport.msi /q /norestart", 0, true
 WshShell.Run "msiexec /I itunes.msi TRANSFORMS=itunes.mst /q /norestart", 0, true
 WshShell.Run "msiexec /I quicktime.msi DESKTOP_SHORTCUTS=0 SCHEDULE_ASUW=0 REENABLEAUTORUN=0 /q /norestart", 0, true

' set parental controls, that disables "Run first welcome window", "Cannot change parental controls" and "No autoupdate"

 Dim wshShell

 Set wshShell = CreateObject( "WScript.Shell" )
 wshShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Apple Computer, Inc.\iTunes\Parental Controls\Default\AdminFlags", 16777473, "REG_DWORD"

Copy this to notepad++ or another editor, save as *.vbs :-)

Removing iTunes without GUIDs

To avoid having to check the GUIDs every time you update this package, you can change the removal process to refer to the original MSIs. If you do this and later decide to remove iTunes from your site, you have to keep the installers in %SOFTWARE% until every computer has removed iTunes.

To do this, replace the remove stanzas with the following:

Apple Application Support

	<remove cmd='msiexec /x %SOFTWARE%\itunes\AppleApplicationSupport.msi /passive /norestart' timeout='300'>
                <!-- <exit code='any' /> --> <!-- uncomment to just rely on the check conditions -->
		<exit code='0' />
		<exit code='1605' />
		<exit code='3010' reboot='postponed' />
	</remove>

Apple Mobile Device Support

        <remove cmd='msiexec /x "%PKG_SOURCE%" /passive /norestart' timeout='300'>    
                <!-- <exit code='any' /> --> <!-- uncomment to just rely on the check conditions -->
		<exit code='0' />
		<exit code='1605' />
		<exit code='3010' reboot='postponed' />
        </remove>

iTunes

        <remove cmd='msiexec.exe /x "%PKG_SOURCE%" /passive /norestart' timeout='300'>
                <!-- <exit code='any' /> --> <!-- uncomment to just rely on the check conditions -->
                <exit code='0' />
                <exit code='1605' />
                <!-- <exit code='3010' reboot='postponed' /> -->
        </remove>