Author Dominik Daehn, based on Office 2013 Code by Jens Eppler, based on Office 2010 Code by Soren Birk
Dieses Paket installiert Microsoft Office 2010, 2013 und 2016 in der 32-Bit und 64-Bit Version.
Das Skript beinhaltet Produkteigenschaften die zur Laufzeit in die config.xml geschrieben werden.
Das Setup installiert nur die Produkte die in der Produkteigenschaft “products“ angegeben sind.
Das Skript funktioniert für verschiedenen Versionen von Office. Voraussetzung ist die Anpassung der Variablen $OfficeId$ in den Dateien setup.opsicript und uninstall.opsicript. Welche Version von Office Sie einsetzen, können Sie anhand des Installationsmediums feststellen. Dort befindet sich ein Ordner mit dem Namen ”[productid].ww”. Außerdem befindet sich in diesem Ordner die Datei config.xml, in der die korrekte Produkt ID in der ersten Zeile steht <Setup Id =”…”>.
Ein Wechsel der installierten Office Architektur ist möglich indem das Paket nochmal auf setup gesetzt wird.
Falls auf einem Windows 32-Bit Client die Installation von Office 64-Bit ausgewählt wird, erfolgt automatisch die Installation von Office 32-Bit.
Anleitung:
This package installs Microsoft Office 2010, 2013 and 2016 in the 32-bit and 64-bit version.
In my script I am using some ProductProperties wich are written into a config.xml which is used for the silent installation then.
The setup will install only the products wich are selected by the multivalue property “products”.
You might be able to also use this script with different versions of Office if you replace the variable $OfficeId$ in the files setup.opsicript and uninstall.opsicript. You can discover your version of Office when you look at the folders on your installmedia. There should be a folder named ”[productid].ww”. To verify this check inside this folder the file named “setup.xml”. The correct product id is shown there in the first lines <Setup Id =”…”>.
To change the installed Office architecture just set the package to setup again.
If the installation of Office 64-bit is selected on a Windows 32-bit client, the setup change to Office 32-bit automatically.
Instructions:
Tested with:
Tree:
CLIENT_DATA ├ config.xml ├ delsub32.opsiscript ├ delsub64.opsiscript ├ office2016.png ├ setup.opsiscript ├ uninstall.opsiscript ├ x64 └ ... └ x86 └ ...
; Author Dominik Daehn, based on Office 2013 Code by Jens Eppler, based on Office 2010 Code by Soren Birk [Actions] requiredWinstVersion >= "4.11.3.5" DefVar $LogDir$ DefVar $ProductId$ DefVar $ProductName$ DefVar $OfficeId$ DefVar $OfficeVersion$ DefVar $MinimumSpace$ DefVar $InstallDir$ DefVar $InstallPfad$ DefVar $SystemType$ DefVar $OfficeArchitecture$ DefVar $LicenseKey$ DefVar $LicenseRequired$ DefVar $LicensePool$ DefVar $UninstallProgram$ DefVar $UninstCmd$ DefVar $ExitCode$ DefVar $exitcodeActivation$ DefVar $Config_Product$ DefVar $Config_Eula$ DefVar $Config_Log$ DefVar $Config_Reboot$ DefVar $UserName$ DefVar $CompanyName$ DefVar $ACCESSFiles$ DefVar $EXCELFiles$ DefVar $GrooveFiles2$ DefVar $OUTLOOKFiles$ DefVar $PPTFiles$ DefVar $PubPrimary$ DefVar $QueryFiles$ DefVar $WORDFiles$ DefVar $XDOCSFiles$ DefVar $LYNCFiles$ DefVar $ONENOTEFiles$ DefVar $VISIOVIEWERFiles$ DefStringList $Products$ ; ---------------------------------------------------------------- ; - Please edit the following values - ; ---------------------------------------------------------------- Set $LogDir$ = "%SystemDrive%\tmp" Set $ProductId$ = "office2016" Set $ProductName$ = "Office 2016 Professional Plus" Set $OfficeId$ = "ProPlus" Set $OfficeVersion$ = "Office16" Set $MinimumSpace$ = "3 GB" Set $InstallDir$ = "Microsoft Office" Set $SystemType$ = GetSystemType Set $OfficeArchitecture$ = GetProductProperty("architecture","") Set $LicenseKey$ = GetProductProperty("LicenseKey","") ;Variablen zum patchen der config.xml Set $Config_Product$ = '<Configuration Product="' + $OfficeId$ + '">' Set $Config_Eula$ = '<Display Level="basic" CompletionNotice="no" SuppressModal="yes" AcceptEula="yes" />' Set $Config_Log$ = '<Logging Type="standard" Path="' + $LogDir$ + '" Template="' + $ProductName$ + '_Setup(*).txt" />' Set $Config_Reboot$ = '<Setting Id="SETUP_REBOOT" Value="Never" />' Set $UserName$ = '<USERNAME Value="' + GetProductProperty("username", "Valued Customer") + '" />' Set $CompanyName$ = '<COMPANYNAME Value="' + GetProductProperty("companyname", "") + '" />' Set $Products$ = GetProductPropertyList("products","True") Set $ACCESSFiles$ = takeFirstStringContaining($Products$, "Access") Set $EXCELFiles$ = takeFirstStringContaining($Products$, "Excel") Set $GrooveFiles2$ = takeFirstStringContaining($Products$, "OneDrive") Set $OUTLOOKFiles$ = takeFirstStringContaining($Products$, "Outlook") Set $PPTFiles$ = takeFirstStringContaining($Products$, "PowerPoint") Set $PubPrimary$ = takeFirstStringContaining($Products$, "Publisher") Set $WORDFiles$ = takeFirstStringContaining($Products$, "Word") Set $LYNCFiles$ = takeFirstStringContaining($Products$, "Skype") Set $ONENOTEFiles$ = takeFirstStringContaining($Products$, "OneNote") Set $VISIOVIEWERFiles$ = takeFirstStringContaining($Products$, "VisioViewer") ; ---------------------------------------------------------------- ; The old comparison [if GetMsVersionInfo < "6"] doesn't work with Windows 10, as the GetMSVersionInfo returns "10.0", which the comparison can't handle properly if CompareDotSeparatedNumbers(GetMsVersionInfo,"6.0") < "0" LogError "This is for NT 6 (Vista) and above" isFatalError else ;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 ;OneDrive 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 ;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 ;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 ;Skype installieren oder nicht if not ($LYNCFiles$ = "") Set $LYNCFiles$ = '<OptionState Id="LyncCoreFiles" State="local" Children="force" />' else Set $LYNCFiles$ = '<OptionState Id="LyncCoreFiles" State="absent" Children="force" />' endif ;OneNote installieren oder nicht if not ($ONENOTEFiles$ = "") Set $ONENOTEFiles$ = '<OptionState Id="OneNoteFiles" State="local" Children="force" />' else Set $ONENOTEFiles$ = '<OptionState Id="OneNoteFiles" State="absent" Children="force" />' endif ;VisioViewer installieren oder nicht if not ($VISIOVIEWERFiles$ = "") Set $VISIOVIEWERFiles$ = '<OptionState Id="VisioPreviewerFiles" State="local" Children="force" />' else Set $VISIOVIEWERFiles$ = '<OptionState Id="VisioPreviewerFiles" 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 if ($OfficeArchitecture$ = "x64") AND ($SystemType$ = "x86 System") set $OfficeArchitecture$ = "x86" comment "change Office architecture to Office x86" endif comment "Display product logo" ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductName$ comment "Copying empty config.xml to $LogDir$" Files_copy_patchtextfile comment "Patching config.xml" PatchTextFile_config_xml $LogDir$ + "\config.xml" if FileExists("%ScriptPath%\delsub32.opsiscript") comment "Start uninstall sub section delsub32" Sub "%ScriptPath%\delsub32.opsiscript" endif if FileExists("%ScriptPath%\delsub64.opsiscript") comment "Start uninstall sub section delsub64" Sub "%ScriptPath%\delsub64.opsiscript" endif Message "Installing " + $ProductId$ + " ..." if ($OfficeArchitecture$ = "x86") AND ($SystemType$ = "64 Bit System") set $InstallPfad$ = "%ProgramFiles32Dir%" else set $InstallPfad$ = "%ProgramFiles64Dir%" endif comment "Start setup program" ChangeDirectory "%SCRIPTPATH%" Winbatch_install Sub_check_exitcode 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 endif [Files_copy_patchtextfile] copy "%ScriptPath%\config.xml" $LogDir$ [PatchTextFile_config_xml] FindLine "</Configuration>" InsertLine '$LYNCFiles$' InsertLine '$ONENOTEFiles$' InsertLine '$VISIOVIEWERFiles$' InsertLine '$WORDFiles$' InsertLine '$QueryFiles$' InsertLine '$PubPrimary$' InsertLine '$PPTFiles$' InsertLine '$OUTLOOKFiles$' InsertLine '$GrooveFiles2$' InsertLine '$EXCELFiles$' InsertLine '$ACCESSFiles$' InsertLine '$CompanyName$' InsertLine '$UserName$' InsertLine '$Config_Reboot$' InsertLine '$Config_Log$' InsertLine '$Config_Eula$' InsertLine '$Config_Product$' [Winbatch_install] "%ScriptPath%\$OfficeArchitecture$\setup.exe" /config "$LogDir$\config.xml" [DosInAnIcon_set_key] cscript //b "$InstallPfad$\$InstallDir$\$OfficeVersion$\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 Dominik Daehn, based on Office 2013 Code by Jens Eppler, based on Office 2010 Code by Soren Birk [Actions] requiredWinstVersion >= "4.11.2.6" DefVar $LogDir$ DefVar $ProductId$ DefVar $ProductName$ DefVar $OfficeId$ DefVar $OfficeVersion$ DefVar $InstallDir$ DefVar $SystemType$ DefVar $LicenseRequired$ DefVar $LicensePool$ DefVar $UninstallProgram$ DefVar $UninstCmd$ DefVar $ExitCode$ DefVar $Config_Product$ DefVar $Config_Eula$ DefVar $Config_Log$ DefVar $Config_Reboot$ ; ---------------------------------------------------------------- ; - Please edit the following values - ; ---------------------------------------------------------------- Set $LogDir$ = "%SystemDrive%\tmp" Set $ProductId$ = "office2016" Set $ProductName$ = "Office 2016 Professional Plus" Set $OfficeId$ = "ProPlus" Set $OfficeVersion$ = "Office16" Set $InstallDir$ = "Microsoft Office" Set $SystemType$ = GetSystemType Set $Config_Product$ = '<Configuration Product="' + $OfficeId$ + '">' Set $Config_Eula$ = '<Display Level="basic" CompletionNotice="no" SuppressModal="yes" AcceptEula="yes" />' Set $Config_Log$ = '<Logging Type="standard" Path="' + $LogDir$ + '" Template="' + $ProductName$ + '_Uninstall(*).txt" />' Set $Config_Reboot$ = '<Setting Id="SETUP_REBOOT" Value="Never" />' ; ---------------------------------------------------------------- comment "Display product logo" ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductName$ Message "Uninstalling " + $ProductId$ + " ..." comment "Copying empty config.xml to $LogDir$" Files_copy_patchtextfile comment "Patching config.xml" PatchTextFile_config_xml $LogDir$ + "\config.xml" if FileExists("%ScriptPath%\delsub32.opsiscript") comment "Start uninstall sub section delsub32" Sub "%ScriptPath%\delsub32.opsiscript" endif if FileExists("%ScriptPath%\delsub64.opsiscript") comment "Start uninstall sub section delsub64" Sub "%ScriptPath%\delsub64.opsiscript" endif [Files_copy_patchtextfile] copy "%ScriptPath%\config.xml" $LogDir$ [PatchTextFile_config_xml] FindLine "</Configuration>" InsertLine '$Config_Reboot$' InsertLine '$Config_Log$' InsertLine '$Config_Eula$' InsertLine '$Config_Product$'
; Author Dominik Daehn, based on Office 2013 Code by Jens Eppler, based on Office 2010 Code by Soren Birk Set $UninstallProgram$ = "%ScriptPath%\x86\setup.exe" Set $UninstCmd$ = "/uninstall " + $OfficeId$ + " /config " + $LogDir$ + "\config.xml" Message "Uninstalling " + $ProductId$ + " ..." if FileExists("%ProgramFiles32Dir%\" + $InstallDir$ + "\" + $OfficeVersion$ + "\ospp.vbs") comment "The program seems to be installed, starting the uninstallation." Winbatch_uninstall sub_check_exitcode endif [Winbatch_uninstall] $UninstallProgram$ $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
; Author Dominik Daehn, based on Office 2013 Code by Jens Eppler, based on Office 2010 Code by Soren Birk Set $UninstallProgram$ = "%ScriptPath%\x64\setup.exe" Set $UninstCmd$ = "/uninstall " + $OfficeId$ + " /config " + $LogDir$ + "\config.xml" Message "Uninstalling " + $ProductId$ + " ..." if FileExists("%ProgramFiles64Dir%\" + $InstallDir$ + "\" + $OfficeVersion$ + "\ospp.vbs") AND ($SystemType$ = "64 Bit System") comment "The program seems to be installed, starting the uninstallation." Winbatch_uninstall sub_check_exitcode endif [Winbatch_uninstall] $UninstallProgram$ $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>
[Package] version: 1 depends: incremental: False [Product] type: localboot id: office2016 name: Office 2016 description: Office 2016 advice: version: 1.0 priority: 0 licenseRequired: True productClasses: setupScript: setup.opsiscript uninstallScript: uninstall.opsiscript updateScript: alwaysScript: onceScript: customScript: userLoginScript: [ProductProperty] type: unicode name: architecture multivalue: False editable: False description: Architektur der Office Installation values: ["x64", "x86"] default: ["x64"] [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 fuer die Installation values: [""] default: [""] [ProductProperty] type: unicode name: products multivalue: True editable: False description: Installationsoptionen, was wird installiert values: ["Access", "Excel", "OneDrive", "OneNote", "Outlook", "PowerPoint", "Publisher", "Skype", "VisioViewer", "Word"] default: ["Access", "Excel", "OneNote", "PowerPoint", "Publisher", "VisioViewer", "Word"] [Changelog] office-2016 (1.0-1) stable; urgency=low * Initial package -- Dominik Daehn <...> Tue, 5 Jan 2016