====== F-Secure Client 9.32 Via Management ====== //Scripts and guide by Soren Birk// This is F-Secure-client which is used together with a server management-console. **Tested With:** * OPSI 4.0.2.4 * Winst 4.11.3.3 * Windows 7, 32 and 64-Bit Start by setting up the server-side and exporting your preferences to the client install-file (rename and move to CLIENT_DATA). I have commented the check exitcode sub-sections, as they were giving me an error because of the pending restart. The PC will reboot when the package has been uninstalled/installed. Give the client time to contact the server for the config when installed. **Tree:** CLIENT_DATA ├ fsecureclient.msi ├ fsecurelogo.png ├ setup32.ins ├ uninstall32.ins └ delsub32.ins ==== Setup32.ins ==== ; Author Soren Birk [Actions] requiredWinstVersion >= "4.11.2.6" DefVar $MsiId$ DefVar $LogDir$ DefVar $ProductId$ DefVar $MinimumSpace$ DefVar $InstallDir$ DefVar $ExitCode$ DefVar $LicenseRequired$ DefVar $LicenseKey$ DefVar $LicensePool$ DefVar $RebootFlag$ DefVar $WinstRegKey$ Set $LogDir$ = "%SystemDrive%\tmp" Set $WinstRegKey$ = "HKLM\SOFTWARE\opsi.org\winst" Set $RebootFlag$ = GetRegistryStringValue("["+$WinstRegKey$+"] "+"RebootFlag") ; ---------------------------------------------------------------- ; - Please edit the following values - ; ---------------------------------------------------------------- Set $ProductId$ = "fsecureclient" Set $MinimumSpace$ = "1 GB" Set $InstallDir$ = "%ProgramFiles32Dir%\F-Secure" 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 "Not enough free space" else comment "Display product logo" ShowBitmap "%ScriptPath%\fsecurelogo.png" $ProductId$ if not (($RebootFlag$ = "1") or ($RebootFlag$ = "2")) comment "Rebootflag is set to 1, indicating that this section has been activated" Set $RebootFlag$ = "1" Registry_SaveRebootFlag /32Bit if FileExists("%ScriptPath%\delsub32.ins") comment "Start uninstall sub section" Sub "%ScriptPath%\delsub32.ins" endif endif if ($RebootFlag$ = "1") Message "Installing " + $ProductId$ + " ..." if $LicenseRequired$ = "true" comment "Licensing required, reserve license and get license key" Sub_get_licensekey endif comment "Start setup-program" ChangeDirectory "%SCRIPTPATH%" Winbatch_install /WaitForProcessEnding "fssetup.exe" ; Sub_check_exitcode comment "Rebootflag is set to 2, indicating that the product has been installed" Set $RebootFlag$ = "2" Registry_SaveRebootFlag /32Bit Message "Rebooting" ExitWindows /ImmediateReboot else comment "Rebootflag is reset" Set $RebootFlag$ = "0" Registry_SaveRebootFlag /32Bit endif endif [Winbatch_install] msiexec /i "%ScriptPath%\fsecureclient.msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=1 REBOOT=ReallySuppress [Registry_SaveRebootFlag] openKey [$WinstRegKey$] set "RebootFlag" = "$RebootFlag$" [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 ==== Uninstall32.ins ==== ; Author Soren Birk [Actions] requiredWinstVersion >= "4.11.2.6" DefVar $MsiId$ DefVar $LogDir$ DefVar $ExitCode$ DefVar $ProductId$ DefVar $InstallDir$ DefVar $LicenseRequired$ DefVar $LicensePool$ DefVar $RebootFlag$ DefVar $WinstRegKey$ Set $LogDir$ = "%SystemDrive%\tmp" Set $WinstRegKey$ = "HKLM\SOFTWARE\opsi.org\winst" Set $RebootFlag$ = GetRegistryStringValue("["+$WinstRegKey$+"] "+"RebootFlag") ; ---------------------------------------------------------------- ; - Please edit the following values - ; ---------------------------------------------------------------- Set $ProductId$ = "fsecureclient" Set $InstallDir$ = "%ProgramFiles32Dir%\F-secure" Set $LicenseRequired$ = "false" Set $LicensePool$ = "p_" + $ProductId$ ; ---------------------------------------------------------------- comment "Display product logo" ShowBitmap "%ScriptPath%\fsecurelogo.png" $ProductId$ Message "Uninstalling " + $ProductId$ + " ..." if not ($RebootFlag$ = "1") comment "Rebootflag is set to 1, indicating that this section has been activated" Set $RebootFlag$ = "1" Registry_SaveRebootFlag /32Bit if FileExists("%ScriptPath%\delsub32.ins") comment "Start uninstall sub section" Sub "%ScriptPath%\delsub32.ins" endif if $LicenseRequired$ = "true" comment "Licensing required, free license used" Sub_free_license endif else comment "Rebootflag is reset" Set $RebootFlag$ = "0" Registry_SaveRebootFlag /32Bit endif [Registry_SaveRebootFlag] openKey [$WinstRegKey$] set "RebootFlag" = "$RebootFlag$" [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$) ==== Delsub32.ins ==== ; Author Soren Birk Set $MsiId$ = '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}' Message "Uninstalling " + $ProductId$ + " ..." if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId$ + "] DisplayName") = "") comment "MSI id " + $MsiId$ + " found in registry, starting msiexec to uninstall" Winbatch_uninstall_msi ; sub_check_exitcode comment "Deleting files" Files_uninstall Message "Rebooting" ExitWindows /ImmediateReboot endif [Winbatch_uninstall_msi] msiexec /x $MsiId$ /qb! REBOOT=ReallySuppress [Files_uninstall] del -sf "$InstallDir$\" [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