diff --git a/CLIENT_DATA/activate-win.png b/CLIENT_DATA/activate-win.png new file mode 100644 index 0000000..c660d15 Binary files /dev/null and b/CLIENT_DATA/activate-win.png differ diff --git a/CLIENT_DATA/ms-activation.vbs b/CLIENT_DATA/ms-activation.vbs deleted file mode 100644 index 464479b..0000000 --- a/CLIENT_DATA/ms-activation.vbs +++ /dev/null @@ -1,7 +0,0 @@ -for each Obj in GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("win32_WindowsProductActivation") - if Obj.ActivationRequired <> 0 then - 'If necessary, save/set proxy - Obj.ActivateOnline() - 'If necessary, restore proxy - end if -next \ No newline at end of file diff --git a/CLIENT_DATA/service_batch.bat b/CLIENT_DATA/service_batch.bat deleted file mode 100644 index 0ea8b75..0000000 --- a/CLIENT_DATA/service_batch.bat +++ /dev/null @@ -1,4 +0,0 @@ -rundll32 user32.dll LockWorkStation %windir% -ms-activation.vbs -sc config opsiclientd start= auto -net start opsiclientd diff --git a/CLIENT_DATA/setup.ins b/CLIENT_DATA/setup.ins new file mode 100644 index 0000000..80f8e02 --- /dev/null +++ b/CLIENT_DATA/setup.ins @@ -0,0 +1,161 @@ +; 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://www.opsi.org/credits/ + +[Actions] +requiredWinstVersion >= "4.11.1.1" + +DefVar $LogDir$ +DefVar $ProductId$ +DefVar $LicenseRequired$ +DefVar $LicenseKey$ +DefVar $LicensePool$ +DefVar $poolOrKey$ +DefVar $source$ +DefVar $httpproxy$ + +Set $LogDir$ = "%SystemDrive%\tmp" + +Set $ProductId$ = "activate-win" + + + +; ---------------------------------------------------------------- +; see: +; http://technet.microsoft.com/en-us/library/ff793433.aspx + +if GetMsVersionInfo < "6" + LogError "This is for NT 6 (Vista) and above" + isFatalError +else + + comment "Show product picture" + ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ + + + Message "Installing " + $ProductId$ + " ..." + + set $poolOrKey$ = GetProductProperty("Poolid-or-Licensekey","") + set $source$ = GetProductProperty("method","only-activate") + set $httpproxy$ = GetProductProperty("httpproxy","") + + comment "Check Status" + DosInAnIcon_status_win7 winst /sysnative + + if not ( $httpproxy$ = "" ) + comment "enable HTTP proxy, required for auto-activating" + DosInAnIcon_setproxy_win7 winst /sysnative + endif + + if not ($source$ = "only-activate") + comment " we need a key..." + if $source$ = "opsi License management" + Set $LicenseRequired$ = "true" + Set $LicensePool$ = $poolOrKey$ + comment " get key from license management with poolid "+$LicensePool$ + comment "Licensing required, reserve license and get license key" + Sub_get_licensekey + else + Set $LicenseRequired$ = "false" + Set $LicensePool$ = "" + set $LicenseKey$ = $poolOrKey$ + comment " use key "+$LicenseKey$ + endif + + comment "Set the Key" + DosInAnIcon_set_key winst /sysnative + + comment "Check Status" + DosInAnIcon_status_win7 winst /sysnative + endif + + comment "Start Activation" + DosInAnIcon_activate winst /sysnative + + comment "Check Status" + DosInAnIcon_status_win7 winst /sysnative + +endif + +[DosInAnIcon_set_key] +cscript //b c:\windows\system32\slmgr.vbs /ipk $LicenseKey$ + +[DosInAnIcon_activate] +cscript //b c:\windows\system32\slmgr.vbs /ato + +[DosInAnIcon_status_win7] +cscript c:\windows\system32\slmgr.vbs /dli + + + +[Sub_get_licensekey] +if opsiLicenseManagementEnabled + comment "License management is enabled and will be used" + + comment "Trying to get a license key" + Set $LicenseKey$ = demandLicenseKey ($LicensePool$) + ; If there is an assignment of exactly one licensepool to the product the following call is possible: + ; Set $LicenseKey$ = demandLicenseKey ("", $ProductId$) + ; + ; 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 ("", "", $WindowsSoftwareId$) + + DefVar $ServiceErrorClass$ + set $ServiceErrorClass$ = getLastServiceErrorClass + comment "Error class: " + $ServiceErrorClass$ + + if $ServiceErrorClass$ = "None" + comment "Everything fine, we got the license key '" + $LicenseKey$ + "'" + else + if $ServiceErrorClass$ = "LicenseConfigurationError" + LogError "Fatal: license configuration must be corrected" + LogError getLastServiceErrorMessage + isFatalError + else + if $ServiceErrorClass$ = "LicenseMissingError" + LogError "Fatal: required license is not supplied" + isFatalError + endif + endif + endif +else + LogError "Fatal: license required, but license management not enabled" + isFatalError +endif + + +[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 + +[DosInAnIcon_setproxy_win7] +;netsh.exe winhttp set proxy proxy:3128 ";*.mynet.local" +netsh.exe winhttp set proxy $httpproxy$ diff --git a/CLIENT_DATA/setup32.ins b/CLIENT_DATA/setup32.ins deleted file mode 100644 index 7dbd8c5..0000000 --- a/CLIENT_DATA/setup32.ins +++ /dev/null @@ -1,193 +0,0 @@ -; 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://www.opsi.org/credits/ - -[Actions] -requiredWinstVersion >= "4.10.8.6" - - -DefVar $Proxy_Port$ -DefVar $Flag$ -DefVar $WinstRegKey$ -DefVar $MsiId$ -DefVar $UninstallProgram$ -DefVar $LogDir$ -DefVar $ProductId$ -DefVar $MinimumSpace$ -DefVar $InstallDir$ -DefVar $ExitCode$ -DefVar $LicenseRequired$ -DefVar $LicenseKey$ -DefVar $LicensePool$ - -Set $LogDir$ = "%SystemDrive%\tmp" -Set $WinstRegKey$ = "HKLM\SOFTWARE\opsi.org\winst" -Set $Flag$ = GetRegistryStringValue32("["+$WinstRegKey$+"] "+"RebootFlag") -Set $Proxy_Port$ = "pubproxy:3128" - -; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh -; and adds the following variables: -; from builder-product.cfg : all variables definded by attribute WINST[index] -; from builder-product.cfg : VENDOR PN VERSION RELEASE PRIORITY ADVICE TYPE -; from opsi-builder.cfg : CREATOR_TAG CREATOR_NAME CREATOR_EMAIL -; auto generated winst-variables -; $IconFile$: path to product picture -; -DefVar $VENDOR$ -Set $VENDOR$ = "microsoft.com" -DefVar $PN$ -Set $PN$ = "windows.activation" -DefVar $VERSION$ -Set $VERSION$ = "1" -DefVar $RELEASE$ -Set $RELEASE$ = "5" -DefVar $PRIORITY$ -Set $PRIORITY$ = "0" -DefVar $ADVICE$ -Set $ADVICE$ = "" -DefVar $TYPE$ -Set $TYPE$ = "public" -DefVar $CREATOR_TAG$ -Set $CREATOR_TAG$ = "dt" -DefVar $CREATOR_NAME$ -Set $CREATOR_NAME$ = "Dennis Trinks" -DefVar $CREATOR_EMAIL$ -Set $CREATOR_EMAIL$ = "dennis.trinks@dtnet.de" -DefVar $IconFile$ -Set $IconFile$ = "%ScriptPath%\windows.activation.png" - - -; ---------------------------------------------------------------- -; - Please edit the following values - -; ---------------------------------------------------------------- -;$ProductId$ should be the name of the product in opsi -; therefore please: only lower letters, no umlauts, -; no white space use '-' as a seperator -Set $ProductId$ = "windows.activation" -Set $MinimumSpace$ = "1 MB" -; the path were we find the product after the installation -Set $InstallDir$ = "%ProgramFiles32Dir%\" -Set $LicenseRequired$ = "false" -Set $LicensePool$ = "p_" + $ProductId$ -; ---------------------------------------------------------------- - -if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$)) - LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$ - isFatalError - ; Stop process and set installation status to failed -else -; comment "Show product picture" -; ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ - - if FileExists("%ScriptPath%\delsub32.ins") - comment "Start uninstall sub section" - Sub "%ScriptPath%\delsub32.ins" - endif - - Message "Installing " + $ProductId$ + " ..." - - if $LicenseRequired$ = "true" - comment "Licensing required, reserve license and get license key" - Sub_get_licensekey - endif - - if $Flag$ = "" - Set $Flag$ = "1" - Registry_SaveRebootFlag - DOSInAnIcon_AddActivationAdmin - DOSInAnIcon_deactOpsiSrv -; DOSInAnIcon_SetProxy - Files_install_servicebatch - Files_install - Registry_SetAutoadmin - Registry_SetRunOnce - ExitWindows /ImmediateReboot - Endif - - if $Flag$ = "1" - Set $Flag$ = "2" - DOSInAnIcon_deactOpsiSrv - Registry_SetRunOnce - Registry_SaveRebootFlag - ExitWindows /ImmediateReboot - Endif - - if $Flag$ = "2" - Set $Flag$ = "3" - Registry_SaveRebootFlag - Registry_DisableAutoadmin - ExitWindows /ImmediateReboot - Endif - - - if $Flag$ = "3" - Registry_DeleteRebootFlag - DOSInAnIcon_DeleteActivationAdmin - Endif -endif - -[Files_install_servicebatch] -copy "%ScriptPath%\service_batch.bat" "C:\tmp" - -[Files_install] -copy "%ScriptPath%\ms-activation.vbs" %System% - -[Winbatch_install] -; Choose one of the following examples as basis for your installation -; You can use $LicenseKey$ var to pass a license key to the installer -; -; === Nullsoft Scriptable Install System ================================================================ - -ms-activation.vbs - -[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$ - isFatalError -endif - -[Registry_SaveRebootFlag] -openKey [$WinstRegKey$] -set "RebootFlag" = "$Flag$" - -[Registry_DeleteRebootFlag] -openKey [$WinstRegKey$] -DeleteVar "RebootFlag" - -[Registry_SetAutoadmin] -openkey [HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] -set "DefaultUserName"="activationadmin" -set "DefaultPassword"="4ct1vat!0n" -set "DefaultDomainName"="%PCName%" -set "AutoAdminLogon"="1" - -[Registry_DisableAutoadmin] -openkey [HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] -set "DefaultUserName"="" -set "DefaultPassword"="" -set "AutoAdminLogon"="0" - -[Registry_SetRunOnce] -openkey [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce] -set "OpsiService"="C:\tmp\service_batch.bat" - -[DOSInAnIcon_AddActivationAdmin] -net user activationadmin 4ct1vat!0n /add -net localgroup Administratoren /add activationadmin - -[DOSInAnIcon_DeleteActivationAdmin] -net user activationadmin /delete - -[DOSInAnIcon_SetProxy] -proxycfg -p $Proxy_Port$ - -[DOSInAnIcon_deactOpsiSrv] -sc config opsiclientd start= disabled diff --git a/OPSI/changelog.txt b/OPSI/changelog.txt index bc69317..42a54cc 100644 --- a/OPSI/changelog.txt +++ b/OPSI/changelog.txt @@ -1,2 +1,40 @@ -Don't add cahngelog entries here! -It get autogenerated by the opsi-builder.sh \ No newline at end of file +activate-win (1.0-6) stable; urgency=low + * added proxysettings + +-- bardo wolf 03 Sep 2012 + +activate-win (1.0-5) stable; urgency=low + + * property: 'Poolid or Licensekey' renamed to licensekey from property + - modified the tooltip from property method. + * modified productId in setup.ins + * added winflag.png as product-picture + + -- erol ueluekmen Fr, 10 Aug 2012 14:01:53 +0200 + +activate-win (1.0-4) stable; urgency=low + + * property: 'Poolid or Licensekey' to decied which source + * property: 'license source' to get Poolid or Licensekey + + -- detlef oertel Fr, 09 Dec 2011 16:01:53 +0200 + + +activate-win (1.0-3) stable; urgency=low + + * added poolid productProperty + + -- erol ueluekmen Mon, 19 Sep 2011 16:01:53 +0200 + +activate-win (1.0-2) stable; urgency=low + + * sysnativ + + -- bardo wolf Mon, 19 Sep 2011 15:01:53 +0200 + +opsi-template (1.0-1) stable; urgency=low + + * initial + + -- detlef oertel Mon, 05 Sep 2011 16:01:53 +0200 + diff --git a/OPSI/control b/OPSI/control index 7759f62..29965e6 100644 --- a/OPSI/control +++ b/OPSI/control @@ -1,23 +1,50 @@ [Package] -version: RELEASE +version: 6 depends: incremental: False [Product] type: localboot -id: windows.activation -name: windows.activation -description: Activating MS-OS (XP/2003) -advice: ADVICE -version: VERSION -priority: PRIORITY +id: activate-win +name: Windows Activation +description: Tries to activate this Windows installation +advice: +version: 1.0 +priority: 0 licenseRequired: False productClasses: -setupScript: setup32.ins -uninstallScript: uninstall32.ins +setupScript: setup.ins +uninstallScript: updateScript: alwaysScript: onceScript: customScript: userLoginScript: +[ProductProperty] +type: unicode +name: poolid-or-licensekey +multivalue: False +editable: True +description: id from opsi-license-management-pool or license key + +[ProductProperty] +type: unicode +name: method +multivalue: False +editable: False +description: What should we do: + "only-activate" : activate with the installed key + "opsi License management": get key from opsi (need the poolid in other property) and activate + "licensekey from property": get licensekey from property 'poolid-or-licensekey' and activate +values: ["licensekey from property", "only-activate", "opsi License management"] +default: ["only-activate"] + +[ProductProperty] +type: unicode +name: httpproxy +multivalue: False +editable: True +description: httpproxy needed for activation proxy.mycompany.com:3218 +default: [""] +