Kaspersky Endpoint Security 8.1 & 10.1

darpakiss 2013/02/11 13:21

Tested on Windows 7 64bit

Tested with opsi 4.0.2
required Winst Version >= 4.11.3.1
Files can be downloaded at here

Tree:

CLIENT_DATA
check_msi-exitcode.ins
delsub.ins
install.cfg
Kaspersky.key
Kaspersky.png
Kes10win_x64.msi
Kes10win_x86.msi
Kes8win_x64.msi
Kes8win_x86.msi
setup.ini
setup.ins
uninstall.ins
OPSI
control

Steps

  1. Download Kaspersky Security Center from here. Old version which contains KES8, can be downloaded from here.
  2. Start to install ksc10.0.3361.0en.exe, But you can abort it after decompressing the needed files into C:\ksc 10.0 directory. Repeat it with ksc9.
  3. You can find Kes10Win_*.msi files in directory C:\ksc 10.0\en\Server\Packages\KES_10.1.0.867\exec
  4. You can find Kes8Win_*.msi files in directory C:\ksc 9.2\en\Server\Packages\KES_8.1.0.831\exec
  5. You need an etalon install, after installing you should follow this instruction and this
  6. You need an activation code in file called Kaspersky.key
  7. You should create a logo from an images from internet, and save with name Kaspersky.png
  8. If you want to use from other path, check and change the path of check_msi-exitcode.ins in the scripts

setup.ins

[Initial]
LogLevel=9
;  Log Errors in Logfile but don't abort:
ExitOnError=false
; Show syntax errors in the script:
ScriptErrorMessages=on
; Dont trace step by step through the script:
TraceMode=off
; let started programs run in front of the winst window
StayOnTop=false
 
 
[Actions]
requiredWinstVersion >= "4.10.8.6"
 
DefVar $UninstallProgram32$
DefVar $UninstallProgram64$
DefVar $LogDir$
DefVar $ProductId$
DefVar $MinimumSpace$
DefVar $InstallDir32$
DefVar $InstallDir64$
DefVar $ExitCode$
DefVar $LicenseRequired$
DefVar $LicenseKey$
DefVar $LicensePool$
DefVar $INST_SystemType$
DefVar $INST_version$
DefVar $Version$
DefVar $Inst_Cmd32$
DefVar $Inst_Cmd64$
DefVar $Inst_Prg32$
DefVar $Inst_Prg64$
DefVar $Uninst_Prg$
 
Set $INST_SystemType$ = GetSystemType
set $INST_version$ = GetProductProperty("version","8.1")
 
if ($INST_version$ = "8.1")
	Set $Inst_Prg32$ = "Kes8win_x86.msi"
	Set $Inst_Prg64$ = "Kes8win_x64.msi"
endif
if ($INST_version$ = "10.1")
	Set $Inst_Prg32$ = "Kes10win_x86.msi"
	Set $Inst_Prg64$ = "Kes10win_x64.msi"
endif
 
 
Set $LogDir$ = "%SystemDrive%\tmp"
 
; ----------------------------------------------------------------
; - 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$       = "Kaspersky"
Set $Version$         = "10.1"
Set $MinimumSpace$    = "300 MB"
; the path were we find the product after the installation
Set $InstallDir32$      = "%ProgramFilesDir%\TightVNC"
Set $LicenseRequired$ = "false"
Set $LicensePool$     = "p_" + $ProductId$
Set $Uninst_Prg$      = "uninstall.exe"
Set $Inst_Cmd32$      = '/quiet /norestart EULA=1 KSN=1 ALLOWREBOOT=1'
; ----------------------------------------------------------------
 
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$ + " " + $INST_version$
 
	if FileExists("%ScriptPath%\delsub.ins")
		comment "Start uninstall sub section"
		Sub "%ScriptPath%\delsub.ins"
	endif
 
    if $LicenseRequired$ = "true"
		comment "Licensing required, reserve license and get license key"
		Sub_get_licensekey
    endif
 
 
 
	if ($INST_SystemType$ = "x86 System")
		Message "Installing " + $ProductId$ + " on 32 Bit..."
		comment "Start setup program"
		Winbatch_install_32
		Sub_check_exitcode
	endif
 
    if ($INST_SystemType$ = "64 Bit System")
		Message "Installing " + $ProductId$ + " on 64 Bit..."
		comment "Start setup program"
		Winbatch_install_64
		Sub_check_exitcode
	endif
endif
 
ExitWindows /reboot
 
[Winbatch_install_32]
msiexec /i %ScriptPath%\$Inst_Prg32$ $Inst_Cmd32$
 
[Winbatch_install_64]
msiexec /i %ScriptPath%\$Inst_Prg64$ $Inst_Cmd32$
 
[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

uninstall.ins

[Initial]
LogLevel=9
;  Log Errors in Logfile but don't abort:
ExitOnError=false
; Show syntax errors in the script:
ScriptErrorMessages=on
; Dont trace step by step through the script:
TraceMode=off
; let started programs run in front of the winst window
StayOnTop=false
 
[Actions]
requiredWinstVersion >= "4.10.8.6"
 
DefVar $LogDir$
DefVar $ExitCode$
DefVar $ProductId$
DefVar $InstallDir32$
DefVar $InstallDir64$
DefVar $LicenseRequired$
DefVar $LicensePool$
DefVar $INST_SystemType$
DefVar $INST_architecture$
DefVar $DisplayName$
 
Set $INST_SystemType$ = GetSystemType
 
 
Set $LogDir$ = "%SystemDrive%\tmp"
 
; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
Set $ProductId$		= "Kaspersky"
Set $InstallDir32$	= "%ProgramFilesDir%\Kaspersky"
Set $LicenseRequired$	= "false"
Set $LicensePool$	= "p_" + $ProductId$
; ----------------------------------------------------------------
 
comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
 
Message "Uninstalling " + $ProductId$ + " ..."
 
if FileExists("%ScriptPath%\delsub.ins")
        comment "Start uninstall sub section"
        Sub "%ScriptPath%\delsub.ins"
endif
 
if $LicenseRequired$ = "true"
        comment "Licensing required, free license used"
        Sub_free_license
endif
 
[Sub_free_license]
comment "License management is enabled and will be used"
 
comment "Trying to free license used for the product"
DefVar $result$
Set $result$ = FreeLicense($LicensePool$)
; If there is an assignment of a license pool to the product, it is possible to use
; Set $result$ = FreeLicense("", $ProductId$)
;
; If there is an assignment of a license pool to a windows software id, it is possible to use
; DefVar $WindowsSoftwareId$
; $WindowsSoftwareId$ = "..."
; set $result$ = FreeLicense("", "", $WindowsSoftwareId$)
 
ExitWindows /reboot

delsub.ins

DefStringList $result$
DefStringList $result1$
 
DefVar $INST_arch$
Set $INST_arch$ = "Both"
 
DefVar $INST2_SystemType$
Set $INST2_SystemType$ = GetSystemType
 
DefVar $appKey$
DefVar $UninstallCommandList$
DefVar $UninstallCommandList2$
DefVar $appString$
DefVar $appKeyString$
DefVar $testName$
DefVar $exeString$
Set $appKeyString$ = "DisplayName"
Set $appString$ = "Kaspersky Endpoint Security"
 
if ($INST2_SystemType$ = "x86 System" OR $INST_arch$ = "Both")
	Message "Uninstalling " + $appString$ + " 32 Bit..."
	comment "Start setup program"
	Set $result$ = getRegistryKeyList32("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall")
	for $app$ in $result$ do Sub_searchApp32
endif
 
if ($INST2_SystemType$ = "64 Bit System" OR $INST_arch$ = "Both")
	Message "Uninstalling " + $appString$ + " 64 Bit..."
    comment "Start setup program"
	Set $result$ = getRegistryKeyList64("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall")
	for $app$ in $result$ do Sub_searchApp64
endif
 
if not ($UninstallCommandList$ = "")
	set $result1$ = splitString($UninstallCommandList$,"::")
	for $UninstallCommand$ in $result1$ do Winbatch_Uninstall
	sub "%ScriptPath%\check_msi-exitcode.ins"
endif
 
if not ($UninstallCommandList2$ = "")
	set $result1$ = splitString($UninstallCommandList2$,"::")
	for $UninstallCommand2$ in $result1$ do Dosbatch_Uninstall
	sub "%ScriptPath%\check_msi-exitcode.ins"
endif
 
[Sub_searchApp32]
	set $appKey$ = "[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + "$app$" + "] " + $appKeyString$
	Set $testName$ = GetRegistryStringValue32($appKey$)
	if contains($testName$,$appString$)
		set $appKey$ = "[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + "$app$" + "] UninstallString"
		Set $testName$ = GetRegistryStringValue32($appKey$)
		if contains(lower($testName$),lower("MsiExec.exe"))
			set $UninstallCommandList$ = $UninstallCommandList$ + "MsiExec.exe /x " + "$app$" + " /qb-! REBOOT=ReallySuppress::"
		else
			Set $testName$ = unquote($testName$,'"')
			Set $testName$ = unquote($testName$,"'")
			Set $exeString$ = takeString(0, splitString ($testName$, "exe"))
			set $UninstallCommandList$ = $UninstallCommandList$ + $exeString$ + "exe /S::"
		endif
	endif
 
[Sub_searchApp64]
	set $appKey$ = "[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + "$app$" + "] " + $appKeyString$
	Set $testName$ = GetRegistryStringValue64($appKey$)
	if contains($testName$,$appString$)
		set $appKey$ = "[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + "$app$" + "] UninstallString"
		Set $testName$ = GetRegistryStringValue64($appKey$)
		if contains(lower($testName$),lower("MsiExec.exe"))
			set $UninstallCommandList$ = $UninstallCommandList$ + "MsiExec.exe /x " + "$app$" + " /qb-! REBOOT=ReallySuppress::"
		else
			Set $testName$ = unquote($testName$,'"')
			Set $testName$ = unquote($testName$,"'")
			Set $exeString$ = takeString(0, splitString ($testName$, "exe"))
			set $UninstallCommandList$ = $UninstallCommandList$ + '"' + $exeString$ + 'exe /S"::'
		endif
	endif
 
[Winbatch_Uninstall]
$UninstallCommand$

control

[Package]
version: 4
depends: 
incremental: False

[Product]
type: localboot
id: kaspersky
name: Kaspersky Endpoint Security 10.1
description: Kaspersky Endpoint Security for Windows
advice: 
version: 10.1.0
priority: 0
licenseRequired: False
productClasses: 
setupScript: setup.ins
uninstallScript: uninstall.ins
updateScript: 
alwaysScript: 
onceScript: 
customScript: 
userLoginScript: 

[ProductProperty]
type: unicode
name: version
multivalue: False
editable: True
description: Which Kaspersky version to install
values: ["10.1", "8.1"]
default: ["10.1"]

QR Code
QR Code userspace:kaspersky_endpoint_security (generated for current page)