This is an old revision of the document!
Script by d.oertel
Comments and improvements welcome
Tested with opsi 4.0.2
Tested with opsi-winst 4.11.2.6 - 4.11.3.2
Tested with Windows XP Professional and Windows 7 (x86/x64)
dotnetfx is needed, so make a dependency
http://eraser.heidi.ie/index.php
http://eraser.heidi.ie/forum/viewtopic.php?f=2&t=6629&p=27007#p27007
; 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/en/credits/ [Actions] requiredWinstVersion >= "4.10.8.6" setloglevel = 6 DefVar $MsiId32$ DefVar $MsiId64$ DefVar $LogDir$ DefVar $ProductId$ DefVar $MinimumSpace$ DefVar $InstallDir$ DefVar $ExitCode$ Set $LogDir$ = "%SystemDrive%\tmp" ; ---------------------------------------------------------------- ; - Please edit the following values - ; ---------------------------------------------------------------- Set $ProductId$ = "eraser" Set $MinimumSpace$ = "6 MB" ; the path were we find the product after the installation if GetSystemType = "64 Bit System" Set $InstallDir$ = "%ProgramFiles64Dir%\Eraser" else Set $InstallDir$ = "%ProgramFiles32Dir%\Eraser" endif ; ---------------------------------------------------------------- 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%\delsub.ins") comment "Start uninstall sub section" Sub "%ScriptPath%\delsub.ins" endif Message "Installing " + $ProductId$ + " ..." comment "Start setup program" ; The eraser setup.exe is a selfextracting exe ; extract it with 7zip and you will get two msi files (32/64) ChangeDirectory "%SCRIPTPATH%" if GetSystemType = "64 Bit System" Winbatch_install_64 else Winbatch_install_32 endif includelog $LogDir$+"\"+$ProductId$+".install_log.txt" "10" Sub_check_exitcode if GetMSVersionInfo < "6.0" Registry loadUnicodeTextFile("%scriptpath%\hkcu-nt5.reg") /regedit /AllNTUserDats endif endif [Winbatch_install_32] msiexec /i "%ScriptPath%\eraser (x86).msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=1 REBOOT=ReallySuppress [Winbatch_install_64] msiexec /i "%ScriptPath%\eraser (x64).msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=1 REBOOT=ReallySuppress [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
Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Eraser] [HKEY_CURRENT_USER\Software\Eraser\Eraser 6] [HKEY_CURRENT_USER\Software\Eraser\Eraser 6\3460478d-ed1b-4ecc-96c9-2ca0e8500557] "ClearCompletedTasks"=dword:00000001 "IntegrateWithShell"=dword:00000001 [HKEY_CURRENT_USER\Software\Eraser\Eraser 6\9977d7c4-c940-4b73-a02a-33c9ee2d47fe] "ApprovedPlugins"=hex:00,01,00,00,00,ff,ff,ff,ff,01,00,00,00,00,00,00,00,04,01,\ 00,00,00,e1,01,53,79,73,74,65,6d,2e,43,6f,6c,6c,65,63,74,69,6f,6e,73,2e,47,\ 65,6e,65,72,69,63,2e,44,69,63,74,69,6f,6e,61,72,79,60,32,5b,5b,53,79,73,74,\ 65,6d,2e,47,75,69,64,2c,20,6d,73,63,6f,72,6c,69,62,2c,20,56,65,72,73,69,6f,\ 6e,3d,32,2e,30,2e,30,2e,30,2c,20,43,75,6c,74,75,72,65,3d,6e,65,75,74,72,61,\ 6c,2c,20,50,75,62,6c,69,63,4b,65,79,54,6f,6b,65,6e,3d,62,37,37,61,35,63,35,\ 36,31,39,33,34,65,30,38,39,5d,2c,5b,53,79,73,74,65,6d,2e,42,6f,6f,6c,65,61,\ 6e,2c,20,6d,73,63,6f,72,6c,69,62,2c,20,56,65,72,73,69,6f,6e,3d,32,2e,30,2e,\ 30,2e,30,2c,20,43,75,6c,74,75,72,65,3d,6e,65,75,74,72,61,6c,2c,20,50,75,62,\ 6c,69,63,4b,65,79,54,6f,6b,65,6e,3d,62,37,37,61,35,63,35,36,31,39,33,34,65,\ 30,38,39,5d,5d,04,00,00,00,07,56,65,72,73,69,6f,6e,08,43,6f,6d,70,61,72,65,\ 72,08,48,61,73,68,53,69,7a,65,0d,4b,65,79,56,61,6c,75,65,50,61,69,72,73,00,\ 03,00,03,08,90,01,53,79,73,74,65,6d,2e,43,6f,6c,6c,65,63,74,69,6f,6e,73,2e,\ 47,65,6e,65,72,69,63,2e,47,65,6e,65,72,69,63,45,71,75,61,6c,69,74,79,43,6f,\ 6d,70,61,72,65,72,60,31,5b,5b,53,79,73,74,65,6d,2e,47,75,69,64,2c,20,6d,73,\ 63,6f,72,6c,69,62,2c,20,56,65,72,73,69,6f,6e,3d,32,2e,30,2e,30,2e,30,2c,20,\ 43,75,6c,74,75,72,65,3d,6e,65,75,74,72,61,6c,2c,20,50,75,62,6c,69,63,4b,65,\ 79,54,6f,6b,65,6e,3d,62,37,37,61,35,63,35,36,31,39,33,34,65,30,38,39,5d,5d,\ 08,e5,01,53,79,73,74,65,6d,2e,43,6f,6c,6c,65,63,74,69,6f,6e,73,2e,47,65,6e,\ 65,72,69,63,2e,4b,65,79,56,61,6c,75,65,50,61,69,72,60,32,5b,5b,53,79,73,74,\ 65,6d,2e,47,75,69,64,2c,20,6d,73,63,6f,72,6c,69,62,2c,20,56,65,72,73,69,6f,\ 6e,3d,32,2e,30,2e,30,2e,30,2c,20,43,75,6c,74,75,72,65,3d,6e,65,75,74,72,61,\ 6c,2c,20,50,75,62,6c,69,63,4b,65,79,54,6f,6b,65,6e,3d,62,37,37,61,35,63,35,\ 36,31,39,33,34,65,30,38,39,5d,2c,5b,53,79,73,74,65,6d,2e,42,6f,6f,6c,65,61,\ 6e,2c,20,6d,73,63,6f,72,6c,69,62,2c,20,56,65,72,73,69,6f,6e,3d,32,2e,30,2e,\ 30,2e,30,2c,20,43,75,6c,74,75,72,65,3d,6e,65,75,74,72,61,6c,2c,20,50,75,62,\ 6c,69,63,4b,65,79,54,6f,6b,65,6e,3d,62,37,37,61,35,63,35,36,31,39,33,34,65,\ 30,38,39,5d,5d,5b,5d,01,00,00,00,09,02,00,00,00,03,00,00,00,09,03,00,00,00,\ 04,02,00,00,00,90,01,53,79,73,74,65,6d,2e,43,6f,6c,6c,65,63,74,69,6f,6e,73,\ 2e,47,65,6e,65,72,69,63,2e,47,65,6e,65,72,69,63,45,71,75,61,6c,69,74,79,43,\ 6f,6d,70,61,72,65,72,60,31,5b,5b,53,79,73,74,65,6d,2e,47,75,69,64,2c,20,6d,\ 73,63,6f,72,6c,69,62,2c,20,56,65,72,73,69,6f,6e,3d,32,2e,30,2e,30,2e,30,2c,\ 20,43,75,6c,74,75,72,65,3d,6e,65,75,74,72,61,6c,2c,20,50,75,62,6c,69,63,4b,\ 65,79,54,6f,6b,65,6e,3d,62,37,37,61,35,63,35,36,31,39,33,34,65,30,38,39,5d,\ 5d,00,00,00,00,07,03,00,00,00,00,01,00,00,00,01,00,00,00,03,e3,01,53,79,73,\ 74,65,6d,2e,43,6f,6c,6c,65,63,74,69,6f,6e,73,2e,47,65,6e,65,72,69,63,2e,4b,\ 65,79,56,61,6c,75,65,50,61,69,72,60,32,5b,5b,53,79,73,74,65,6d,2e,47,75,69,\ 64,2c,20,6d,73,63,6f,72,6c,69,62,2c,20,56,65,72,73,69,6f,6e,3d,32,2e,30,2e,\ 30,2e,30,2c,20,43,75,6c,74,75,72,65,3d,6e,65,75,74,72,61,6c,2c,20,50,75,62,\ 6c,69,63,4b,65,79,54,6f,6b,65,6e,3d,62,37,37,61,35,63,35,36,31,39,33,34,65,\ 30,38,39,5d,2c,5b,53,79,73,74,65,6d,2e,42,6f,6f,6c,65,61,6e,2c,20,6d,73,63,\ 6f,72,6c,69,62,2c,20,56,65,72,73,69,6f,6e,3d,32,2e,30,2e,30,2e,30,2c,20,43,\ 75,6c,74,75,72,65,3d,6e,65,75,74,72,61,6c,2c,20,50,75,62,6c,69,63,4b,65,79,\ 54,6f,6b,65,6e,3d,62,37,37,61,35,63,35,36,31,39,33,34,65,30,38,39,5d,5d,04,\ fc,ff,ff,ff,e3,01,53,79,73,74,65,6d,2e,43,6f,6c,6c,65,63,74,69,6f,6e,73,2e,\ 47,65,6e,65,72,69,63,2e,4b,65,79,56,61,6c,75,65,50,61,69,72,60,32,5b,5b,53,\ 79,73,74,65,6d,2e,47,75,69,64,2c,20,6d,73,63,6f,72,6c,69,62,2c,20,56,65,72,\ 73,69,6f,6e,3d,32,2e,30,2e,30,2e,30,2c,20,43,75,6c,74,75,72,65,3d,6e,65,75,\ 74,72,61,6c,2c,20,50,75,62,6c,69,63,4b,65,79,54,6f,6b,65,6e,3d,62,37,37,61,\ 35,63,35,36,31,39,33,34,65,30,38,39,5d,2c,5b,53,79,73,74,65,6d,2e,42,6f,6f,\ 6c,65,61,6e,2c,20,6d,73,63,6f,72,6c,69,62,2c,20,56,65,72,73,69,6f,6e,3d,32,\ 2e,30,2e,30,2e,30,2c,20,43,75,6c,74,75,72,65,3d,6e,65,75,74,72,61,6c,2c,20,\ 50,75,62,6c,69,63,4b,65,79,54,6f,6b,65,6e,3d,62,37,37,61,35,63,35,36,31,39,\ 33,34,65,30,38,39,5d,5d,02,00,00,00,03,6b,65,79,05,76,61,6c,75,65,03,00,0b,\ 53,79,73,74,65,6d,2e,47,75,69,64,01,04,fb,ff,ff,ff,0b,53,79,73,74,65,6d,2e,\ 47,75,69,64,0b,00,00,00,02,5f,61,02,5f,62,02,5f,63,02,5f,64,02,5f,65,02,5f,\ 66,02,5f,67,02,5f,68,02,5f,69,02,5f,6a,02,5f,6b,00,00,00,00,00,00,00,00,00,\ 00,00,08,07,07,02,02,02,02,02,02,02,02,15,5c,e5,e2,88,f1,93,42,a4,b2,1d,8a,\ 01,61,03,b5,01,0b "PlausibleDeniabilityFiles"=hex:00,01,00,00,00,ff,ff,ff,ff,01,00,00,00,00,00,\ 00,00,04,01,00,00,00,7f,53,79,73,74,65,6d,2e,43,6f,6c,6c,65,63,74,69,6f,6e,\ 73,2e,47,65,6e,65,72,69,63,2e,4c,69,73,74,60,31,5b,5b,53,79,73,74,65,6d,2e,\ 53,74,72,69,6e,67,2c,20,6d,73,63,6f,72,6c,69,62,2c,20,56,65,72,73,69,6f,6e,\ 3d,32,2e,30,2e,30,2e,30,2c,20,43,75,6c,74,75,72,65,3d,6e,65,75,74,72,61,6c,\ 2c,20,50,75,62,6c,69,63,4b,65,79,54,6f,6b,65,6e,3d,62,37,37,61,35,63,35,36,\ 31,39,33,34,65,30,38,39,5d,5d,03,00,00,00,06,5f,69,74,65,6d,73,05,5f,73,69,\ 7a,65,08,5f,76,65,72,73,69,6f,6e,06,00,00,08,08,09,02,00,00,00,00,00,00,00,\ 03,00,00,00,11,02,00,00,00,00,00,00,00,0b "ForceUnlockLockedFiles"=dword:00000001 "ExecuteMissedTasksImmediately"=dword:00000001 "DefaultFileErasureMethod"=hex:00,01,00,00,00,ff,ff,ff,ff,01,00,00,00,00,00,00,\ 00,04,01,00,00,00,0b,53,79,73,74,65,6d,2e,47,75,69,64,0b,00,00,00,02,5f,61,\ 02,5f,62,02,5f,63,02,5f,64,02,5f,65,02,5f,66,02,5f,67,02,5f,68,02,5f,69,02,\ 5f,6a,02,5f,6b,00,00,00,00,00,00,00,00,00,00,00,08,07,07,02,02,02,02,02,02,\ 02,02,4e,fc,07,14,ff,fe,75,43,b4,fb,d7,ef,bb,7e,99,22,0b "DefaultUnusedSpaceErasureMethod"=hex:00,01,00,00,00,ff,ff,ff,ff,01,00,00,00,\ 00,00,00,00,04,01,00,00,00,0b,53,79,73,74,65,6d,2e,47,75,69,64,0b,00,00,00,\ 02,5f,61,02,5f,62,02,5f,63,02,5f,64,02,5f,65,02,5f,66,02,5f,67,02,5f,68,02,\ 5f,69,02,5f,6a,02,5f,6b,00,00,00,00,00,00,00,00,00,00,00,08,07,07,02,02,02,\ 02,02,02,02,02,67,a2,8b,bf,1a,23,85,40,9b,f9,20,4d,e6,5a,66,41,0b "PlausibleDeniability"=dword:00000000 [HKEY_CURRENT_USER\Software\Eraser\Eraser 6\e2e55c15-f188-4293-a4b2-1d8a016103b5]
; Copyright (c) uib gmbh (www.uib.de) ; This sourcecode is owned by uib gmbh ; and published under the Terms of the General Public License. ; credits: http://www.opsi.org/en/credits/ Set $MsiId64$ = '{6E5159B4-A519-41EF-80EF-AD58371515DF}' Set $MsiId32$ = '{A45C5EC7-F13E-4414-99BE-47373935C0FE}' Message "Uninstalling " + $ProductId$ + " ..." killtask "eraser.exe" if not (GetRegistryStringValue64("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId64$ + "] DisplayName") = "") Winbatch_uninstall_msi_64 endif if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId32$ + "] DisplayName") = "") Winbatch_uninstall_msi_32 endif comment "Delete files" Files_uninstall /32Bit [Winbatch_uninstall_msi_32] msiexec /x $MsiId32$ /qb! REBOOT=ReallySuppress [Winbatch_uninstall_msi_64] msiexec /x $MsiId64$ /qb! REBOOT=ReallySuppress [Files_uninstall] ; Example for recursively deleting the installation directory (don't forget the trailing backslash): ; 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
; Copyright (c) uib gmbh (www.uib.de) ; This sourcecode is owned by uib gmbh ; and published under the Terms of the General Public License. ; credits: http://www.opsi.org/en/credits/ [Actions] requiredWinstVersion >= "4.10.8.6" setloglevel = 6 DefVar $MsiId32$ DefVar $MsiId64$ DefVar $LogDir$ DefVar $ExitCode$ DefVar $ProductId$ DefVar $InstallDir$ Set $LogDir$ = "%SystemDrive%\tmp" ; ---------------------------------------------------------------- ; - Please edit the following values - ; ---------------------------------------------------------------- Set $ProductId$ = "eraser" if GetSystemType = "64 Bit System" Set $InstallDir$ = "%ProgramFiles64Dir%\Eraser" else Set $InstallDir$ = "%ProgramFiles32Dir%\Eraser" endif ; ---------------------------------------------------------------- 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