This shows you the differences between two versions of the page.
userspace:microsoft_office_activation [2016/01/06 12:25] isnoguter created |
userspace:microsoft_office_activation [2021/08/23 08:37] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Microsoft Office 2010, 2013, 2016 Activation ====== | ||
- | //Author Dominik Daehn, based on Activate-Win Code by uib Gmbh | ||
- | // | ||
- | Microsoft Office 2010, 2013, 2016 Activation. | ||
- | |||
- | **Tested with**: | ||
- | * OPSI 4.0.5.15 | ||
- | * Winst 4.11.4.17 | ||
- | * Windows 7, 64-Bit | ||
- | * Windows 7, 32-Bit | ||
- | |||
- | **Tree:** | ||
- | < | ||
- | CLIENT_DATA | ||
- | ├ activate-office.png | ||
- | └ setup.opsiscript | ||
- | |||
- | </ | ||
- | |||
- | ==== setup.opsiscript ==== | ||
- | <code winst> | ||
- | ; Author Dominik Daehn, based on Activate-Win Code by uib Gmbh | ||
- | |||
- | [Actions] | ||
- | requiredWinstVersion >= " | ||
- | |||
- | DefVar $ProductId$ | ||
- | DefVar $ProductName$ | ||
- | DefVar $InstallDir$ | ||
- | DefVar $Office2010$ | ||
- | DefVar $Office2013$ | ||
- | DefVar $Office2016$ | ||
- | DefVar $ActivationFile$ | ||
- | DefVar $ActivationPfad$ | ||
- | DefVar $OfficeVersion$ | ||
- | DefVar $LogDir$ | ||
- | DefVar $LicenseRequired$ | ||
- | DefVar $LicenseKey$ | ||
- | DefVar $LicensePool$ | ||
- | DefVar $poolOrKey$ | ||
- | DefVar $source$ | ||
- | DefVar $httpproxy$ | ||
- | DefVar $exitcodeState$ | ||
- | DefVar $exitcodeActivation$ | ||
- | DefVar $SystemType$ | ||
- | |||
- | ; ---------------------------------------------------------------- | ||
- | |||
- | Set $ProductId$ | ||
- | Set $ProductName$ = " | ||
- | Set $InstallDir$ = " | ||
- | Set $Office2010$ = " | ||
- | Set $Office2013$ = " | ||
- | Set $Office2016$ = " | ||
- | Set $ActivationFile$ = " | ||
- | Set $SystemType$ = GetSystemType | ||
- | Set $LogDir$ = " | ||
- | |||
- | ; ---------------------------------------------------------------- | ||
- | |||
- | if GetMsVersionInfo < " | ||
- | LogError "This is for NT 6 (Vista) and above" | ||
- | isFatalError | ||
- | else | ||
- | |||
- | if FileExists(" | ||
- | set $ActivationPfad$ = " | ||
- | set $OfficeVersion$ = $Office2010$ | ||
- | endif | ||
- | |||
- | if FileExists(" | ||
- | set $ActivationPfad$ = " | ||
- | set $OfficeVersion$ = $Office2013$ | ||
- | endif | ||
- | |||
- | if FileExists(" | ||
- | set $ActivationPfad$ = " | ||
- | set $OfficeVersion$ = $Office2016$ | ||
- | endif | ||
- | |||
- | if $SystemType$ = "64 Bit System" | ||
- | if FileExists(" | ||
- | set $ActivationPfad$ = " | ||
- | set $OfficeVersion$ = $Office2010$ | ||
- | endif | ||
- | |||
- | if FileExists(" | ||
- | set $ActivationPfad$ = " | ||
- | set $OfficeVersion$ = $Office2013$ | ||
- | endif | ||
- | |||
- | if FileExists(" | ||
- | set $ActivationPfad$ = " | ||
- | set $OfficeVersion$ = $Office2016$ | ||
- | endif | ||
- | endif | ||
- | |||
- | comment "Show product picture" | ||
- | ShowBitmap " | ||
- | |||
- | Message " | ||
- | |||
- | set $poolOrKey$ = GetProductProperty(" | ||
- | set $source$ = GetProductProperty(" | ||
- | set $httpproxy$ = GetProductProperty(" | ||
- | |||
- | comment "Check Status" | ||
- | DosInAnIcon_status_office winst /sysnative | ||
- | set $exitcodeState$ = getLastExitCode | ||
- | |||
- | if not ( $httpproxy$ = "" | ||
- | comment " | ||
- | DosInAnIcon_setproxy_win7 winst /sysnative | ||
- | endif | ||
- | |||
- | if not ($source$ = " | ||
- | comment " we need a key..." | ||
- | if $source$ = "opsi License management" | ||
- | Set $LicenseRequired$ = " | ||
- | Set $LicensePool$ | ||
- | comment " get key from license management with poolid " | ||
- | comment " | ||
- | Sub_get_licensekey | ||
- | else | ||
- | Set $LicenseRequired$ = " | ||
- | Set $LicensePool$ | ||
- | set $LicenseKey$ = $poolOrKey$ | ||
- | comment " use key " | ||
- | endif | ||
- | |||
- | comment "Set the Key" | ||
- | DosInAnIcon_set_key winst /sysnative | ||
- | |||
- | comment "Check Status" | ||
- | DosInAnIcon_status_office winst /sysnative | ||
- | set $exitcodeState$ = getLastExitCode | ||
- | endif | ||
- | |||
- | comment "Start Activation" | ||
- | DosInAnIcon_activate | ||
- | set $exitcodeActivation$ = getLastExitCode | ||
- | |||
- | comment "Check Status" | ||
- | DosInAnIcon_status_office winst /sysnative | ||
- | set $exitcodeState$ = getLastExitCode | ||
- | |||
- | comment "check the exit code of the activation..." | ||
- | if not ($exitcodeActivation$ = " | ||
- | LogError " | ||
- | isFatalError " | ||
- | else | ||
- | comment " | ||
- | endif | ||
- | |||
- | DosInAnIcon_resetproxy_win7 winst /sysnative | ||
- | |||
- | endif | ||
- | |||
- | [DosInAnIcon_set_key] | ||
- | cscript //b " | ||
- | exit %ERRORLEVEL% | ||
- | |||
- | [DosInAnIcon_activate] | ||
- | cscript //b " | ||
- | exit %ERRORLEVEL% | ||
- | |||
- | [DosInAnIcon_status_office] | ||
- | cscript " | ||
- | exit %ERRORLEVEL% | ||
- | |||
- | |||
- | [Sub_get_licensekey] | ||
- | if opsiLicenseManagementEnabled | ||
- | comment " | ||
- | |||
- | comment " | ||
- | Set $LicenseKey$ = demandLicenseKey ($LicensePool$) | ||
- | ; If there is an assignment of exactly one licensepool to the product the following call is possible: | ||
- | ; Set $LicenseKey$ = demandLicenseKey ("", | ||
- | ; | ||
- | ; If there is an assignment of a license pool to a windows software id, it is possible to use: | ||
- | ; DefVar $WindowsSoftwareId$ | ||
- | ; $WindowsSoftwareId$ = " | ||
- | ; Set $LicenseKey$ = demandLicenseKey ("", | ||
- | |||
- | DefVar $ServiceErrorClass$ | ||
- | set $ServiceErrorClass$ = getLastServiceErrorClass | ||
- | comment "Error class: " + $ServiceErrorClass$ | ||
- | |||
- | if $ServiceErrorClass$ = " | ||
- | comment " | ||
- | else | ||
- | if $ServiceErrorClass$ = " | ||
- | LogError " | ||
- | LogError getLastServiceErrorMessage | ||
- | isFatalError | ||
- | else | ||
- | if $ServiceErrorClass$ = " | ||
- | LogError " | ||
- | isFatalError | ||
- | endif | ||
- | endif | ||
- | endif | ||
- | else | ||
- | LogError " | ||
- | isFatalError | ||
- | endif | ||
- | |||
- | |||
- | [Sub_check_exitcode] | ||
- | comment "Test for installation success via exit code" | ||
- | set $ExitCode$ = getLastExitCode | ||
- | ; informations to exit codes see | ||
- | ; http:// | ||
- | ; http:// | ||
- | if ($ExitCode$ = " | ||
- | comment "Looks good: setup program gives exitcode zero" | ||
- | else | ||
- | comment "Setup program gives a exitcode unequal zero: " + $ExitCode$ | ||
- | if ($ExitCode$ = " | ||
- | comment " | ||
- | comment " | ||
- | else | ||
- | if ($ExitCode$ = " | ||
- | comment "looks good: setup program gives exitcode 1641" | ||
- | comment " | ||
- | else | ||
- | if ($ExitCode$ = " | ||
- | comment "looks good: setup program gives exitcode 3010" | ||
- | comment " | ||
- | else | ||
- | logError " | ||
- | isFatalError | ||
- | endif | ||
- | endif | ||
- | endif | ||
- | endif | ||
- | |||
- | |||
- | [DosInAnIcon_setproxy_win7] | ||
- | netsh.exe winhttp set proxy $httpproxy$ | ||
- | |||
- | [DosInAnIcon_resetproxy_win7] | ||
- | netsh.exe winhttp reset proxy | ||
- | </ | ||
- | |||
- | ==== control ==== | ||
- | < | ||
- | [Package] | ||
- | version: 1 | ||
- | depends: | ||
- | incremental: | ||
- | |||
- | [Product] | ||
- | type: localboot | ||
- | id: activate-office | ||
- | name: Microsoft Office Activation | ||
- | description: | ||
- | advice: | ||
- | version: 1.0 | ||
- | priority: 0 | ||
- | licenseRequired: | ||
- | productClasses: | ||
- | setupScript: | ||
- | uninstallScript: | ||
- | updateScript: | ||
- | alwaysScript: | ||
- | onceScript: | ||
- | customScript: | ||
- | userLoginScript: | ||
- | |||
- | [ProductProperty] | ||
- | type: unicode | ||
- | name: poolid-or-licensekey | ||
- | multivalue: False | ||
- | editable: True | ||
- | description: | ||
- | |||
- | [ProductProperty] | ||
- | type: unicode | ||
- | name: method | ||
- | multivalue: False | ||
- | editable: False | ||
- | description: | ||
- | " | ||
- | " | ||
- | " | ||
- | values: [" | ||
- | default: [" | ||
- | |||
- | [ProductProperty] | ||
- | type: unicode | ||
- | name: httpproxy | ||
- | multivalue: False | ||
- | editable: True | ||
- | description: | ||
- | values: ["" | ||
- | default: ["" | ||
- | |||
- | [Changelog] | ||
- | activate-office (1.0-1) stable; urgency=low | ||
- | |||
- | * Initial package | ||
- | |||
- | -- Dominik Daehn < | ||
- | </ |