I actually decided to write up this guide for all who are interested... its my 1st for this place, so please... ANY suggestions are very much welcome.
iTunes v4.7 Silent InstallationUpdated: 12/14/04 @ 10:10 EST
OverviewThis guide will walk you through configuring a silent installation of iTunes v4.7 for use with a Windows XP Unattended Installation, using VBScripting. It also explains why the workaround is necessary as well as how to uninstall the optional QuickTime components that arent required for iTunes.
Why an iTunes silent installation is such a pain in the arse...The reason why youre forced to go through these somewhat painful steps in order to install iTunes without any user intervention is simply because the installer its packaged in is screwed up. Ive seen a few people say this started occurring in version 4.7... I never tried it prior to this, so Im not sure if this is the case. If it worked without issue you would have a couple different options available to accomplish this.
You should be able to use the -s parameter (after creating the setup.iss file) and have it automatically install without intervention, but for some reason your still prompted with the 1st initial screen that youre forced to click 'Next' to... after you hit next, it installs silently as it should... but this obviously isnt a true silent install.
Another option you
should have available to you is similar to what prathapml touched on... using the msi thats packaged in the installer with the '/QB' parameters, but this come back with some stupid error.
So alas, youre forced to brew up some work-around to accomplish this if you dont want to touch the install at all...
Configuring your iTunes silent install1. Uninstall iTunes if you already have it installed.
2. Install iTunes using the following command
CODE
setup.exe -r
This will launch the installer as normal, enter the options during this install exactly how you want it setup after your silent install.
3. Once you complete the installation process, you should be able to find the 'answer file' it created, with all the option you chose, in your WINDOWS folder. Place it in the same location that the iTunes setup.exe is going to be in on your UA CD.
4. Open notepad, copy and paste the following in it and save it as 'setup.vbs'. Place this in the same location as mentioned above.
Dim FSO, WshShell, AllDrives, CDROM, SYSD, APP, MsgBox
Set FSO = CreateObject("Scripting.FileSystemObject")
Set AllDrives = FSO.Drives
Set WshShell = WScript.CreateObject("WScript.Shell")
SYSD = WshShell.ExpandEnvironmentStrings("%Systemdrive%")
' Check for CDROM
For Each objDrive In fso.Drives
If objDrive.DriveType = "4" And objDrive.IsReady Then
If fso.FileExists(objDrive & "\WIN51") Then cdrom = objDrive
End If
Next
If Len(CDROM) = 0 Then
MsgBox "Error: CD-ROM not found!",vbCritical,"Diskeeper"
WScript.Quit
End if
APP = CDROM & "\Custom\Applications"
' Launch Silent Installer
WshShell.Run (APP & "\iTunes\setup.exe -s -f2" & SYSD & "\iTunes.log")
' Wait for Install Window to come to focus
Do until WshShell.AppActivate ("iTunes for Windows")
WScript.Sleep 2000
Loop
WScript.Sleep 500
' Hit N for Next
WshShell.SendKeys "N"
' Wait for Installation to complete by checking for the iTunes.log
Do until FSO.FileExists(SYSD & "\iTunes.log")
WScript.Sleep 3000
Loop
WScript.Quit
5. Now you need to modify this file thats specific to your setup
a. The text in red is the parent folder where all your application install folders should be. The 'Custom' folder in this example is on the same level as i386 and $OEM$. Inside this, I have this 'Applications' folder (as well as a couple other folders for regtweaks and drivers, but those arent pertinent to this example) and within the Applications folder I have folders for each pieces of software that I want to install during my UA (ie: iTunes, Diskeeper, WinRAR, etc).
b. The text in orange is obviously the specific folder and install exe for iTunes
NOTE: You could simply specify the full path and file of the setup.exe on the APP line and get rid of everything in Orange, but this way I can use the entire upper portion of code for other VBScripts as well
6. Now call the setup.vbs script from your RunOnceEx.cmd, similar to the following:
CODE
REG ADD %KEY%\033 /VE /D "iTunes v4.7" /f
REG ADD %KEY%\033 /V 1 /D "<Enter Path to iTunes folder here>\setup.vbs" /f
setup.vbs ExplainedEverything above the line starting with 'APP' declares and sets variables, including one for your CD-ROM drive. This example assumes you have a file 'WIN51' in the root of your UA CD, if you dont, simply replace this with a file that does exist.
The next 15 or so lines (down to the 'Hit N for Next' line) launches the installer, waits for the dialog box to appear, then simulates the 'N' keystroke so next is chosen.
The installer creates a log file (iTunes.log), once its complete, at the root of your system drive, the last loop statement looks for this before the script completes. If this wasnt added the VBScript would complete and RunOnceEx would start the next line even though iTunes is still installing. Whether or not you want to keep this file (I dont bother), you may want to include it to be deleted in your cleanup.cmd.
Hate QuickTimeI hate it and while you think you dont hate it, you do and unwillingly, QuickTime is also installed during your iTunes setup. In fact iTunes uses key component from it to operate, so unfortunately you cant uninstall it completely. You can, however, uninstall the optional components, which include the shortcuts for quicktime it creates.
Again, I couldnt find any easy way to this (one liner batch command), so I whipped up this script...
CODE
Set WshShell = WScript.CreateObject("WScript.Shell")
' Launch Uninstaller
WshShell.Run "C:\WINDOWS\unvise32qt.exe /s C:\WINDOWS\System32\QuickTime\Uninstall.log"
' Wait for Uninstall Window to come to focus
Do until WshShell.AppActivate ("QuickTime Uninstall")
WScript.Sleep 2000
Loop
WScript.Sleep 500
' send 1 'tab' keystrokes to choose 'Uninstall'
WshShell.SendKeys "{TAB}"
' send the 'enter' keystroke
WshShell.SendKeys "{ENTER}"
' Wait 5 seconds for Uninstall to Complete
WScript.Sleep 5000
WScript.Quit
The only thing with this you may have to alter is the last Sleep line... depending on how slow your system is, you may need to increase this, but it should leave for plenty of time.
I called this 'UIQT.vbs' (UnInstall QuickTime) and placed it in the same folder as my iTunes files. I also created a seperate line for RunOnceEx to call it from as I wanted to treat the installation of iTunes and uninstallation of QuickTime components as 2 seperate items. If its not obvious (which it really should), you want to make sure you run this script after youve run the iTunes installer.
Thats pretty much it. Again.. my 1st guide for this place, so I hope others will find it helpful and easy. Let me know if anything should be clarified, added, removed, etc...