This shows you the differences between two versions of the page.
userspace:activate_win [2012/10/04 10:38] bhubal [Activate-Win] |
userspace:activate_win [2021/08/23 08:37] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Activate-Win ====== | ||
- | Windows Activation\\ | ||
- | 2012-09-13\\ | ||
- | Script by uib Gmbh \\ | ||
- | Comments and improvements welcome \\ | ||
- | |||
- | Tested with opsi 4.0.2 \\ | ||
- | |||
- | Full-Package at | ||
- | http:// | ||
- | |||
- | |||
- | ==== setup.ins ==== | ||
- | |||
- | <code winst> | ||
- | ; Copyright (c) uib gmbh (www.uib.de) | ||
- | ; This sourcecode is owned by uib | ||
- | ; and published under the Terms of the General Public License. | ||
- | ; credits: http:// | ||
- | |||
- | [Actions] | ||
- | requiredWinstVersion >= " | ||
- | |||
- | DefVar $LogDir$ | ||
- | DefVar $ProductId$ | ||
- | DefVar $LicenseRequired$ | ||
- | DefVar $LicenseKey$ | ||
- | DefVar $LicensePool$ | ||
- | DefVar $poolOrKey$ | ||
- | DefVar $source$ | ||
- | DefVar $httpproxy$ | ||
- | |||
- | Set $LogDir$ = " | ||
- | |||
- | Set $ProductId$ | ||
- | |||
- | |||
- | |||
- | ; ---------------------------------------------------------------- | ||
- | ; see: | ||
- | ; http:// | ||
- | |||
- | if GetMsVersionInfo < " | ||
- | LogError "This is for NT 6 (Vista) and above" | ||
- | isFatalError | ||
- | else | ||
- | |||
- | comment "Show product picture" | ||
- | ShowBitmap " | ||
- | |||
- | |||
- | Message " | ||
- | |||
- | set $poolOrKey$ = GetProductProperty(" | ||
- | set $source$ = GetProductProperty(" | ||
- | set $httpproxy$ = GetProductProperty(" | ||
- | |||
- | comment "Check Status" | ||
- | DosInAnIcon_status_win7 winst /sysnative | ||
- | |||
- | if not ( $httpproxy$ = "" | ||
- | 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_win7 winst /sysnative | ||
- | endif | ||
- | |||
- | comment "Start Activation" | ||
- | DosInAnIcon_activate | ||
- | |||
- | comment "Check Status" | ||
- | DosInAnIcon_status_win7 winst /sysnative | ||
- | |||
- | endif | ||
- | |||
- | [DosInAnIcon_set_key] | ||
- | cscript //b c: | ||
- | |||
- | [DosInAnIcon_activate] | ||
- | cscript //b c: | ||
- | |||
- | [DosInAnIcon_status_win7] | ||
- | cscript c: | ||
- | |||
- | |||
- | |||
- | [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 proxy:3128 "< | ||
- | netsh.exe winhttp set proxy $httpproxy$ | ||
- | |||
- | </ |