1 | ; Copyright (c) uib gmbh (www.uib.de)
|
---|
2 | ; This sourcecode is owned by uib gmbh
|
---|
3 | ; and published under the Terms of the General Public License.
|
---|
4 | ; credits: http://www.opsi.org/credits/
|
---|
5 |
|
---|
6 |
|
---|
7 | ;Set $MsiId32$ = '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}'
|
---|
8 | ;Set $MsiId32$ = 'Citrix XenTools'
|
---|
9 | Set $UninstallProgram32$ = $InstallDir32$ + "\uninstaller.exe"
|
---|
10 |
|
---|
11 | if FileExists($UninstallProgram32$)
|
---|
12 | comment "Uninstall program found (32 bit), starting uninstall"
|
---|
13 | Winbatch_uninstall_32
|
---|
14 | sub_check_exitcode
|
---|
15 | ExitWindows /Reboot
|
---|
16 | endif
|
---|
17 |
|
---|
18 | if FileExists($UninstallProgram64$)
|
---|
19 | comment "Uninstall program found (64 bit), starting uninstall"
|
---|
20 | Winbatch_uninstall_64
|
---|
21 | sub_check_exitcode
|
---|
22 | ExitWindows /Reboot
|
---|
23 | endif
|
---|
24 |
|
---|
25 |
|
---|
26 | ;Set $MsiId64$ = '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}'
|
---|
27 | ;Set $MsiId64$ = 'Citrix XenTools'
|
---|
28 | Set $UninstallProgram64$ = $InstallDir64$ + "\uninstaller.exe"
|
---|
29 |
|
---|
30 | if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
|
---|
31 | Message "Uninstalling " + $ProductId$ + " 32 Bit..."
|
---|
32 |
|
---|
33 | ; if FileExists($UninstallProgram32$)
|
---|
34 | ; comment "Uninstall program found, starting uninstall"
|
---|
35 | ; Winbatch_uninstall_32
|
---|
36 | ; sub_check_exitcode
|
---|
37 | ; endif
|
---|
38 |
|
---|
39 | if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId32$ + "] DisplayName") = "")
|
---|
40 | comment "MSI id " + $MsiId32$ + " found in registry, starting msiexec to uninstall"
|
---|
41 | Winbatch_uninstall_msi_32
|
---|
42 | sub_check_exitcode
|
---|
43 | endif
|
---|
44 |
|
---|
45 | comment "Delete files"
|
---|
46 | Files_uninstall_32 /32Bit
|
---|
47 | comment "Cleanup registry"
|
---|
48 | Registry_uninstall /32Bit
|
---|
49 | endif
|
---|
50 |
|
---|
51 | if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
|
---|
52 | Message "Uninstalling " + $ProductId$ + " 64 Bit..."
|
---|
53 |
|
---|
54 | ; if FileExists($UninstallProgram64$)
|
---|
55 | ; comment "Uninstall program found, starting uninstall"
|
---|
56 | ; Winbatch_uninstall_64
|
---|
57 | ; sub_check_exitcode
|
---|
58 | ; endif
|
---|
59 |
|
---|
60 | if not (GetRegistryStringValue64("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId64$ + "] DisplayName") = "")
|
---|
61 | comment "MSI id " + $MsiId64$ + " found in registry, starting msiexec to uninstall"
|
---|
62 | Winbatch_uninstall_msi_64
|
---|
63 | sub_check_exitcode
|
---|
64 | endif
|
---|
65 |
|
---|
66 | comment "Delete files"
|
---|
67 | Files_uninstall_64 /64Bit
|
---|
68 | comment "Cleanup registry"
|
---|
69 | Registry_uninstall /64Bit
|
---|
70 | endif
|
---|
71 |
|
---|
72 | comment "Delete program shortcuts"
|
---|
73 | LinkFolder_uninstall
|
---|
74 |
|
---|
75 | [Winbatch_uninstall_32]
|
---|
76 | ; Choose one of the following examples as basis for program uninstall
|
---|
77 | ;
|
---|
78 | ; === Nullsoft Scriptable Install System ================================================================
|
---|
79 | ; "$UninstallProgram32$" /S
|
---|
80 | "$UninstallProgram32$" /S /norestart
|
---|
81 |
|
---|
82 | ; === Inno Setup ========================================================================================
|
---|
83 | ; "$UninstallProgram32$" /silent /norestart
|
---|
84 |
|
---|
85 |
|
---|
86 | [Winbatch_uninstall_msi_32]
|
---|
87 | msiexec /x $MsiId32$ /qb! REBOOT=ReallySuppress
|
---|
88 |
|
---|
89 | [Files_uninstall_32]
|
---|
90 | ; Example for recursively deleting the installation directory (don't forget the trailing backslash):
|
---|
91 | ;
|
---|
92 | ; delete -sf "$InstallDir32$\"
|
---|
93 |
|
---|
94 | [Winbatch_uninstall_64]
|
---|
95 | ; Choose one of the following examples as basis for program uninstall
|
---|
96 | ;
|
---|
97 | ; === Nullsoft Scriptable Install System ================================================================
|
---|
98 | ; "$UninstallProgram64$" /S
|
---|
99 | "$UninstallProgram64$" /S /norestart
|
---|
100 |
|
---|
101 | ; === Inno Setup ========================================================================================
|
---|
102 | ; "$UninstallProgram64$" /silent /norestart
|
---|
103 |
|
---|
104 |
|
---|
105 | [Winbatch_uninstall_msi_64]
|
---|
106 | msiexec /x $MsiId64$ /qb! REBOOT=ReallySuppress
|
---|
107 |
|
---|
108 | [Files_uninstall_64]
|
---|
109 | ; Example for recursively deleting the installation directory (don't forget the trailing backslash):
|
---|
110 | ;
|
---|
111 | ; delete -sf "$InstallDir64$\"
|
---|
112 |
|
---|
113 | [Registry_uninstall]
|
---|
114 | ; Example of deleting a registry key:
|
---|
115 | ;
|
---|
116 | ; deletekey [HKEY_LOCAL_MACHINE\Software\$ProductId$]
|
---|
117 |
|
---|
118 | [LinkFolder_uninstall]
|
---|
119 | ; Example of deleting a folder from AllUsers startmenu:
|
---|
120 | ;
|
---|
121 | ; set_basefolder common_programs
|
---|
122 | ; delete_subfolder $ProductId$
|
---|
123 | ;
|
---|
124 | ; Example of deleting a shortcut from AllUsers desktop:
|
---|
125 | ;
|
---|
126 | ; set_basefolder common_desktopdirectory
|
---|
127 | ; set_subfolder ""
|
---|
128 | ; delete_element $ProductId$
|
---|
129 |
|
---|
130 | [Sub_check_exitcode]
|
---|
131 | comment "Test for installation success via exit code"
|
---|
132 | set $ExitCode$ = getLastExitCode
|
---|
133 | ; informations to exit codes see
|
---|
134 | ; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
|
---|
135 | ; http://msdn.microsoft.com/en-us/library/aa368542.aspx
|
---|
136 | if ($ExitCode$ = "0")
|
---|
137 | comment "Looks good: setup program gives exitcode zero"
|
---|
138 | else
|
---|
139 | comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
|
---|
140 | if ($ExitCode$ = "1605")
|
---|
141 | comment "ERROR_UNKNOWN_PRODUCT 1605 This action is only valid for products that are currently installed."
|
---|
142 | comment "Uninstall of a not installed product failed - no problem"
|
---|
143 | else
|
---|
144 | if ($ExitCode$ = "1641")
|
---|
145 | comment "looks good: setup program gives exitcode 1641"
|
---|
146 | comment "ERROR_SUCCESS_REBOOT_INITIATED 1641 The installer has initiated a restart. This message is indicative of a success."
|
---|
147 | else
|
---|
148 | if ($ExitCode$ = "3010")
|
---|
149 | comment "looks good: setup program gives exitcode 3010"
|
---|
150 | comment "ERROR_SUCCESS_REBOOT_REQUIRED 3010 A restart is required to complete the install. This message is indicative of a success."
|
---|
151 | else
|
---|
152 | logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
|
---|
153 | isFatalError
|
---|
154 | endif
|
---|
155 | endif
|
---|
156 | endif
|
---|
157 | endif
|
---|
158 |
|
---|