This is an old revision of the document!
Scripts and guide by Jens Eppler based on the script by Soren Birk
I created this package with Office 32-Bit, but it is ment for both 32/64Bit-versions of Windows. I needed to evaluate Soren's script because there are different versions of Microsoft Office 2013 wich are not intended to be used with “setup.exe /admin”. If you get an error message when using this command you might have the ProPlusr version of Microsoft Office 2013. But you can still use the config.xml method to install this product customized. In my script I am using some ProductProperties wich are written into a config.xml which is used for the silent installation then.
Tested with:
Instructions:
Tree:
CLIENT_DATA ├ config.xml ├ delsub32.ins ├ office2k13.png ├ setup32.ins ├ uninstall32.ins ├ uninstconfig.xml └ office2k13 └ ...
; Author Jens Eppler, based on Office 2010 Code by Soren Birk [Actions] requiredWinstVersion >= "4.11.3.5" DefVar $UninstallProgram$ DefVar $LogDir$ DefVar $ProductId$ DefVar $MinimumSpace$ DefVar $InstallDir$ DefVar $ExitCode$ DefVar $LicenseRequired$ DefVar $LicenseKey$ DefVar $LicensePool$ DefVar $UninstCmd$ DefVar $TempDir$ DefVar $exitcodeActivation$ DefVar $UserName$ DefVar $CompanyName$ DefVar $ACCESSFiles$ DefVar $EXCELFiles$ DefVar $GrooveFiles2$ DefVar $OUTLOOKFiles$ DefVar $PPTFiles$ DefVar $PROJECTFiles$ DefVar $PubPrimary$ DefVar $QueryFiles$ DefVar $VISIOFiles$ DefVar $WORDFiles$ DefVar $XDOCSFiles$ DefStringList $Products$ ; ---------------------------------------------------------------- ; - Please edit the following values - ; ---------------------------------------------------------------- Set $LogDir$ = "%SystemDrive%\tmp" Set $ProductId$ = "office2k13" Set $MinimumSpace$ = "2 GB" Set $InstallDir$ = "%ProgramFiles32Dir%\Microsoft Office" ;Set $LicenseKey$ = "" Set $LicenseKey$ = GetProductProperty("LicenseKey","") Set $TempDir$ = "%SystemDrive%\opsi.org\tmp\" ;Set $UserName$ = '<USERNAME Value="Autorisierte Stelle Hessen" />' Set $UserName$ = '<USERNAME Value="' + GetProductProperty("username", "Valued Customer") + '" />' ;Set $CompanyName$ = '<COMPANYNAME Value="Digitalfunk BOS Hessen" />' Set $CompanyName$ = '<COMPANYNAME Value="' + GetProductProperty("companyname", "") + '" />' ;Set $Products$ = createStringList("Access", "Excel", "InfoPath", "Outlook", "PowerPoint", "Word") Set $Products$ = GetProductPropertyList("products","True") Set $ACCESSFiles$ = takeFirstStringContaining($Products$, "Access") Set $EXCELFiles$ = takeFirstStringContaining($Products$, "Excel") Set $GrooveFiles2$ = takeFirstStringContaining($Products$, "SkyDrive") Set $OUTLOOKFiles$ = takeFirstStringContaining($Products$, "Outlook") Set $PPTFiles$ = takeFirstStringContaining($Products$, "PowerPoint") Set $PROJECTFiles$ = takeFirstStringContaining($Products$, "Project") Set $PubPrimary$ = takeFirstStringContaining($Products$, "Publisher") Set $VISIOFiles$ = takeFirstStringContaining($Products$, "Visio") Set $WORDFiles$ = takeFirstStringContaining($Products$, "Word") Set $XDOCSFiles$ = takeFirstStringContaining($Products$, "InfoPath") ; ---------------------------------------------------------------- ; ;Die oben ausgelesenen Variablen als PropertyListOption werden zu Strings, die in die config.xml ein- und dem Installer übergeben werden ;Access installieren oder nicht if not ($ACCESSFiles$ = "") Set $ACCESSFiles$ = '<OptionState Id="ACCESSFiles" State="local" Children="force" />' else Set $ACCESSFiles$ = '<OptionState Id="ACCESSFiles" State="absent" Children="force" />' endif ;Excel installieren oder nicht (inkl. Datenbankanbindung) if not ($EXCELFiles$ = "") Set $QueryFiles$ = '<OptionState Id="QueryFiles" State="local" Children="force" />' Set $EXCELFiles$ = '<OptionState Id="EXCELFiles" State="local" Children="force" />' else Set $QueryFiles$ = '<OptionState Id="QueryFiles" State="absent" Children="force" />' Set $EXCELFiles$ = '<OptionState Id="EXCELFiles" State="absent" Children="force" />' endif ;Skydrive installieren oder nicht if not ($GrooveFiles2$ = "") Set $GrooveFiles2$ = '<OptionState Id="GrooveFiles2" State="local" Children="force" />' else Set $GrooveFiles2$ = '<OptionState Id="GrooveFiles2" State="absent" Children="force" />' endif ;Outlook installieren oder nicht if not ($OUTLOOKFiles$ = "") Set $OUTLOOKFiles$ = '<OptionState Id="OUTLOOKFiles" State="local" Children="force" />' else Set $OUTLOOKFiles$ = '<OptionState Id="OUTLOOKFiles" State="absent" Children="force" />' endif ;Powerpoint installieren oder nicht if not ($PPTFiles$ = "") Set $PPTFiles$ = '<OptionState Id="PPTFiles" State="local" Children="force" />' else Set $PPTFiles$ = '<OptionState Id="PPTFiles" State="absent" Children="force" />' endif ;Project installieren oder nicht if not ($PROJECTFiles$ = "") Set $PROJECTFiles$ = '<OptionState Id="PROJECTFiles" State="local" Children="force" />' else Set $PROJECTFiles$ = '<OptionState Id="PROJECTFiles" State="absent" Children="force" />' endif ;Publisher installieren oder nicht if not ($PubPrimary$ = "") Set $PubPrimary$ = '<OptionState Id="PubPrimary" State="local" Children="force" />' else Set $PubPrimary$ = '<OptionState Id="PubPrimary" State="absent" Children="force" />' endif ;Visio installieren oder nicht if not ($VISIOFiles$ = "") Set $VISIOFiles$ = '<OptionState Id="VISIOFiles" State="local" Children="force" />' else Set $VISIOFiles$ = '<OptionState Id="VISIOFiles" State="absent" Children="force" />' endif ;Word installieren oder nicht if not ($WORDFiles$ = "") Set $WORDFiles$ = '<OptionState Id="WORDFiles" State="local" Children="force" />' else Set $WORDFiles$ = '<OptionState Id="WORDFiles" State="absent" Children="force" />' endif ;InfoPath installieren oder nicht if not ($XDOCSFiles$ = "") Set $XDOCSFiles$ = '<OptionState Id="XDOCSFiles" State="local" Children="force" />' else Set $XDOCSFiles$ = '<OptionState Id="XDOCSFiles" State="absent" Children="force" />' endif 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%\" + $ProductId$ + ".png" if FileExists("%ScriptPath%\delsub32.ins") comment "Start uninstall sub section" Sub "%ScriptPath%\delsub32.ins" endif Message "Installing " + $ProductId$ + " ..." comment "Copying empty config.xml to $TempDir$" Files_copy_patchtextfile comment "Patching config.xml" PatchTextFile_config_xml $TempDir$ + "config.xml" comment "Start setup program" ChangeDirectory "%SCRIPTPATH%" Winbatch_install Sub_check_exitcode if contains($GrooveFiles2$, "absent") comment "Registry-Key für Rechtsklick Skydrive löschen" Registry_SkyDrive_loeschen endif if not ($LicenseKey$ = "") comment "Set License Key" DosInAnIcon_set_key set $exitcodeActivation$ = getLastExitCode if not ($exitcodeActivation$ = "0") LogError "Exitcode unequal zero: "+$exitcodeActivation$+" Activation seems to be failed !" isFatalError "activation failed" else comment "Activation seems to be successful: exit code = 0" endif endif endif [Files_copy_patchtextfile] copy "%ScriptPath%\config.xml" $TempDir$ [PatchTextFile_config_xml] FindLine "</Configuration>" InsertLine '$XDOCSFiles$' InsertLine '$WORDFiles$' InsertLine '$VISIOFiles$' InsertLine '$QueryFiles$' InsertLine '$PubPrimary$' InsertLine '$PROJECTFiles$' InsertLine '$PPTFiles$' InsertLine '$OUTLOOKFiles$' InsertLine '$GrooveFiles2$' InsertLine '$EXCELFiles$' InsertLine '$ACCESSFiles$' InsertLine '$CompanyName$' InsertLine '$UserName$' [Winbatch_install] "%ScriptPath%\Office2k13\setup.exe" /config "$TempDir$\config.xml" [Registry_SkyDrive_loeschen] deletekey [HKCR\AllFilesystemObjects\shell\SPFS.ContextMenu] [DosInAnIcon_set_key] cscript "C:\Program Files (x86)\Microsoft Office\Office15\OSPP.VBS" /inpkey:$LicenseKey$ exit %ERRORLEVEL% [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
; Author Jens Eppler, based on Office 2010 Code by 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$ = "office2k13" Set $InstallDir$ = "%ProgramFiles32Dir%\Microsoft Office" ; ---------------------------------------------------------------- comment "Display product logo" ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" Message "Uninstalling " + $ProductId$ + " ..." if FileExists("%ScriptPath%\delsub32.ins") comment "Start uninstall sub section" Sub "%ScriptPath%\delsub32.ins" endif
; Author Jens Eppler, based on Office 2010 Code by Soren Birk Set $UninstallProgram$ = "%ScriptPath%\Office2k13\setup.exe" Set $UninstCmd$ = "/uninstall ProPlusr /config %ScriptPath%\uninstconfig.xml" Message "Uninstalling " + $ProductId$ + " ..." if FileExists("%ProgramFiles32Dir%\Microsoft Office\Office15\1031") comment "The program seems to be installed, starting the uninstallation." Winbatch_uninstall sub_check_exitcode endif [Winbatch_uninstall] "%ScriptPath%\Office2k13\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
<Configuration Product="ProPlusr"> <Display Level="none" CompletionNotice="no" SuppressModal="yes" AcceptEula="yes" /> <Logging Type="standard" Path="D:\opsi.org\log" Template="Microsoft Office Professional Plus Setup(*).txt" /> <Setting Id="SETUP_REBOOT" Value="Never" /> </Configuration>
<Configuration Product="ProPlusr"> <Display Level="none" CompletionNotice="no" SuppressModal="yes" AcceptEula="yes" /> <Setting Id="SETUP_REBOOT" Value="Never" /> <Logging Type="standard" Path="%temp%" Template="Microsoft Office Professional Plus Setup(*).txt" /> </Configuration>
<code winst> [Package] version: 3 depends: incremental: False
[Product] type: localboot id: office2k13 name: Office 2013 description: Office 2013 advice: version: 1.0 priority: 0 licenseRequired: True productClasses: setupScript: setup32.ins uninstallScript: uninstall32.ins updateScript: alwaysScript: onceScript: customScript: userLoginScript:
[ProductProperty] type: unicode name: username multivalue: False editable: True description: Benutzername values: [“”] default: [“”]
[ProductProperty] type: unicode name: companyname multivalue: False editable: True description: Firmenname values: [“”] default: [“”]
[ProductProperty] type: unicode name: licensekey multivalue: False editable: True description: Lizenzkey für die Installation values: [“”] default: [“”]
[ProductProperty] type: unicode name: products multivalue: True editable: False description: Installationsoptionen, was wird installiert values: [“Access”, “Excel”, “InfoPath”, “Outlook”, “PowerPoint”, “Project”, “Publisher”, “SkyDrive”, “Visio”, “Word”] default: [“Access”, “Excel”, “InfoPath”, “Outlook”, “PowerPoint”, “Word”]
[Changelog] office2k13 (1.0-3) testing; urgency=low
office2k13 (1.0-2) testing; urgency=low
office2k13 (1.0-1) testing; urgency=low
– Jens Eppler <…> Tue, 17 Sep 2013 08:11:32 +0000 <code>