====== Microsoft Office 2010 Professional Plus 32-Bit ======
//Scripts and guide by Soren Birk//
I created this package with Office 32-Bit, but it is ment for both 32/64Bit-versions of Windows.
For a selective installation of programs (Word, Excel, etc.) please take a look at [[userspace:msoffice2013pro|Microsoft Office 2013 Professional Plus 32-Bit]] by Jens Eppler.
**Tested with**:
  * OPSI 4.0.2.4
  * Winst 4.11.3.3
  * Windows 7, 32 and 64-Bit
**Instructions:**
  * Creating the setup:
    * Extract the Office 2010 Prof Plus DVD to CLIENT_DATA\Office2010, and run the setup.exe with the parameter "/admin" (//setup.exe /admin//).
    * Use Microsoft Office Customization Tool to create a config that meets the needs of your company.
    * Take a look at this link for some inspiration: [[http://blog.stealthpuppy.com/deployment/customising-office-2010-before-deployment/|Customizing Office before Deployment]].
    * //Tip: set the display-level to "none" - if it is set to "basic" the user has the option to cancle the installation.//
    * When you have created the .MSP-file, copy it to the "Updates"-subfolder of the Office2010-folder.
  * Creating the uninstconfig.xml:
    * Go to the ProPlus.WW-subfolder of the Office2010-folder, and copy/paste the "config.xml"-file and rename it to "uninstconfig.xml".
    * Edit the .xml-file with the code supplied here.
**Tree:**
CLIENT_DATA
  ├ setup32.ins
  ├ uninstall32.ins
  ├ delsub32.ins
  ├ msoffice2010prologo.png
  └ Office2010
    ├ Updates
    │ └ office2010pro.MSP
    └ ProPlus.WW
      └ uninstconfig.xml
==== Setup32.ins ====
; Author Soren Birk
[Actions]
requiredWinstVersion >= "4.11.2.6"
DefVar $UninstallProgram$
DefVar $LogDir$
DefVar $ProductId$  
DefVar $MinimumSpace$
DefVar $InstallDir$
DefVar $ExitCode$
DefVar $LicenseRequired$
DefVar $LicenseKey$
DefVar $LicensePool$
DefVar $UninstCmd$
Set $LogDir$ = "%SystemDrive%\tmp"
; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
Set $ProductId$       = "msoffice2010pro"
Set $MinimumSpace$    = "2 GB"
Set $InstallDir$      = "%ProgramFiles32Dir%\Microsoft Office"
; ----------------------------------------------------------------
if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
	LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on dirve %SystemDrive% is needed for " + $ProductId$
	isFatalError "Not enough space"
else
	comment "Display product logo"
	ShowBitmap "%ScriptPath%\msoffice2010prologo.png" $ProductId$
	
	if FileExists("%ScriptPath%\delsub32.ins")
		comment "Start uninstall sub section"
		Sub "%ScriptPath%\delsub32.ins"
	endif
	
	Message "Installing " + $ProductId$ + " ..."
	
	comment "Start setup program"
	ChangeDirectory "%SCRIPTPATH%"
	Winbatch_install
	Sub_check_exitcode
	
endif
[Winbatch_install]
"%ScriptPath%\Office2010\setup.exe"
[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode
; informations to exit codes see
; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
; http://msdn.microsoft.com/en-us/library/aa368542.aspx
if ($ExitCode$ = "0")
	comment "Looks good: setup program gives exitcode zero"
else
	comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
	if ($ExitCode$ = "1605")
		comment "ERROR_UNKNOWN_PRODUCT	1605	This action is only valid for products that are currently installed."
		comment "Uninstall of a not installed product failed - no problem"
	else
		if ($ExitCode$ = "1641")
			comment "looks good: setup program gives exitcode 1641"
			comment "ERROR_SUCCESS_REBOOT_INITIATED	1641	The installer has initiated a restart. This message is indicative of a success."
		else
			if ($ExitCode$ = "3010")
				comment "looks good: setup program gives exitcode 3010"
				comment "ERROR_SUCCESS_REBOOT_REQUIRED	3010	A restart is required to complete the install. This message is indicative of a success."
			else
				logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
				isFatalError
			endif
		endif
	endif
endif
==== Uninstall32.ins ====
; Author Soren birk
[Actions]
requiredWinstVersion >= "4.11.2.6"
DefVar $UninstallProgram$
DefVar $LogDir$
DefVar $ExitCode$
DefVar $ProductId$
DefVar $InstallDir$
DefVar $LicenseRequired$
DefVar $LicensePool$
DefVar $UninstCmd$
Set $LogDir$ = "%SystemDrive%\tmp"
; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
Set $ProductId$       = "msoffice2010pro"
Set $InstallDir$      = "%ProgramFiles32Dir%\Microsoft Office"
; ----------------------------------------------------------------
comment "Display product logo"
ShowBitmap "%ScriptPath%\msoffice2010prologo.png" $ProductId$
Message "Uninstalling " + $ProductId$ + " ..."
if FileExists("%ScriptPath%\delsub32.ins")
	comment "Start uninstall sub section"
	Sub "%ScriptPath%\delsub32.ins"
endif
==== Delsub32.ins ====
; Author Soren Birk
Set $UninstallProgram$ = "%ScriptPath%\Office2010\setup.exe"
Set $UninstCmd$ = "/uninstall ProPlus /config %ScriptPath%\Office2010\ProPlus.WW\uninstconfig.xml"
Message "Uninstalling " + $ProductId$ + " ..."
if FileExists("%ProgramFiles32Dir%\Microsoft Office\Office14")
	comment "The program seems to be installed, starting the uninstallation."
	Winbatch_uninstall
	sub_check_exitcode
endif
[Winbatch_uninstall]
"%ScriptPath%\Office2010\setup.exe "$UninstCmd$
[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode
; informations to exit codes see
; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
; http://msdn.microsoft.com/en-us/library/aa368542.aspx
if ($ExitCode$ = "0")
	comment "Looks good: setup program gives exitcode zero"
else
	comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
	if ($ExitCode$ = "1605")
		comment "ERROR_UNKNOWN_PRODUCT	1605	This action is only valid for products that are currently installed."
		comment "Uninstall of a not installed product failed - no problem"
	else
		if ($ExitCode$ = "1641")
			comment "looks good: setup program gives exitcode 1641"
			comment "ERROR_SUCCESS_REBOOT_INITIATED	1641	The installer has initiated a restart. This message is indicative of a success."
		else
			if ($ExitCode$ = "3010")
				comment "looks good: setup program gives exitcode 3010"
				comment "ERROR_SUCCESS_REBOOT_REQUIRED	3010	A restart is required to complete the install. This message is indicative of a success."
			else
				logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
				isFatalError
			endif
		endif
	endif
endif
==== uninstconfig.xml ====