-
Notifications
You must be signed in to change notification settings - Fork 127
/
InstallJava.vbs
311 lines (266 loc) · 12.9 KB
/
InstallJava.vbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
'*******************************************************************************
' Program: Install.vbs
' Author: Mick Pletcher
' Date: 26 April 2012
' Modified:
'
' Program: Java Runtime Environment
' Version: 7u4
' Description: This will uninstall previous versions and then installs
' the current version
' 1) Define the relative installation path
' 2) Create the Log Folder
' 3) Uninstall all previous versions
' 4) Install Current Version
' 5) Cleanup Global Variables
'*******************************************************************************
Option Explicit
REM Define Constants
CONST TempFolder = "c:\temp\"
CONST LogFolderName = "JavaRuntime"
REM Define Global Variables
DIM Architecture : Set Architecture = Nothing
DIM LogFolder : LogFolder = TempFolder & LogFolderName & "\"
DIM RelativePath : Set RelativePath = Nothing
REM Define the relative installation path
DefineRelativePath()
REM Create the Log Folder
CreateLogFolder()
REM Determine Architecture
DetermineArchitecture()
REM Uninstall all Previous Versions
Uninstall()
REM Installx86
Installx86()
If Architecture = "x64" Then
REM Installx64
Installx64()
End If
REM Cleanup Global Variables
GlobalVariableCleanup()
'*******************************************************************************
'*******************************************************************************
Sub DefineRelativePath()
REM Get File Name with full relative path
RelativePath = WScript.ScriptFullName
REM Remove file name, leaving relative path only
RelativePath = Left(RelativePath, InStrRev(RelativePath, "\"))
End Sub
'*******************************************************************************
Sub CreateLogFolder()
REM Define Local Objects
DIM FSO : Set FSO = CreateObject("Scripting.FileSystemObject")
If NOT FSO.FolderExists(TempFolder) then
FSO.CreateFolder(TempFolder)
End If
If NOT FSO.FolderExists(LogFolder) then
FSO.CreateFolder(LogFolder)
End If
REM Cleanup Local Variables
Set FSO = Nothing
End Sub
'*******************************************************************************
Sub DetermineArchitecture()
REM Define Local Objects
DIM WshShell : Set WshShell = CreateObject("WScript.Shell")
REM Define Local Variables
DIM OsType : OsType = WshShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE")
If OsType = "x86" then
Architecture = "x86"
elseif OsType = "AMD64" then
Architecture = "x64"
end if
REM Cleanup Local Variables
Set WshShell = Nothing
Set OsType = Nothing
End Sub
'*******************************************************************************
Sub Uninstall()
REM Define Local Objects
DIM oShell : SET oShell = CreateObject("Wscript.Shell")
REM Define Local Variables
DIM Parameters : Parameters = Chr(32) & "/qb- /norestart"
DIM Uninstall01 : Uninstall01 = "msiexec.exe /x {3248F0A8-6813-11D6-A77B-00B0D0160010}" & Parameters
DIM Uninstall02 : Uninstall02 = "msiexec.exe /x {3248F0A8-6813-11D6-A77B-00B0D0160020}" & Parameters
DIM Uninstall03 : Uninstall03 = "msiexec.exe /x {3248F0A8-6813-11D6-A77B-00B0D0160030}" & Parameters
DIM Uninstall04 : Uninstall04 = "msiexec.exe /x {3248F0A8-6813-11D6-A77B-00B0D0160040}" & Parameters
DIM Uninstall05 : Uninstall05 = "msiexec.exe /x {3248F0A8-6813-11D6-A77B-00B0D0160050}" & Parameters
DIM Uninstall06 : Uninstall06 = "msiexec.exe /x {3248F0A8-6813-11D6-A77B-00B0D0160060}" & Parameters
DIM Uninstall07 : Uninstall07 = "msiexec.exe /x {3248F0A8-6813-11D6-A77B-00B0D0160070}" & Parameters
DIM Uninstall08 : Uninstall08 = "msiexec.exe /x {3248F0A8-6813-11D6-A77B-00B0D0160080}" & Parameters
DIM Uninstall09 : Uninstall09 = "msiexec.exe /x {3248F0A8-6813-11D6-A77B-00B0D0160090}" & Parameters
DIM Uninstall10 : Uninstall10 = "msiexec.exe /x {3248F0A8-6813-11D6-A77B-00B0D0160060}" & Parameters
DIM Uninstall11 : Uninstall11 = "msiexec.exe /x {3248F0A8-6813-11D6-A77B-00B0D0160110}" & Parameters
DIM Uninstall12 : Uninstall12 = "msiexec.exe /x {3248F0A8-6813-11D6-A77B-00B0D0160120}" & Parameters
DIM Uninstall13 : Uninstall13 = "msiexec.exe /x {3248F0A8-6813-11D6-A77B-00B0D0160130}" & Parameters
DIM Uninstall14 : Uninstall14 = "msiexec.exe /x {3248F0A8-6813-11D6-A77B-00B0D0160140}" & Parameters
DIM Uninstall15 : Uninstall15 = "msiexec.exe /x {3248F0A8-6813-11D6-A77B-00B0D0160150}" & Parameters
DIM Uninstall16 : Uninstall16 = "msiexec.exe /x {3248F0A8-6813-11D6-A77B-00B0D0160160}" & Parameters
DIM Uninstall17 : Uninstall17 = "msiexec.exe /x {3248F0A8-6813-11D6-A77B-00B0D0160170}" & Parameters
DIM Uninstall18 : Uninstall18 = "msiexec.exe /x {3248F0A8-6813-11D6-A77B-00B0D0160180}" & Parameters
DIM Uninstall19 : Uninstall19 = "msiexec.exe /x {3248F0A8-6813-11D6-A77B-00B0D0160190}" & Parameters
DIM Uninstall20 : Uninstall20 = "msiexec.exe /x {3248F0A8-6813-11D6-A77B-00B0D0160200}" & Parameters
DIM Uninstall21 : Uninstall21 = "msiexec.exe /x {3248F0A8-6813-11D6-A77B-00B0D0160210}" & Parameters
DIM Uninstall22 : Uninstall22 = "msiexec.exe /x {3248F0A8-6813-11D6-A77B-00B0D0160220}" & Parameters
DIM Uninstall23 : Uninstall23 = "msiexec.exe /x {26A24AE4-039D-4CA4-87B4-2F83216023FF}" & Parameters
DIM Uninstall23x64 : Uninstall23x64 = "msiexec.exe /x {26A24AE4-039D-4CA4-87B4-2F86416023FF}" & Parameters
DIM Uninstall24 : Uninstall24 = "msiexec.exe /x {26A24AE4-039D-4CA4-87B4-2F83216024FF}" & Parameters
DIM Uninstall24x64 : Uninstall24x64 = "msiexec.exe /x {26A24AE4-039D-4CA4-87B4-2F86416024FF}" & Parameters
DIM Uninstall25 : Uninstall25 = "msiexec.exe /x {26A24AE4-039D-4CA4-87B4-2F83216025FF}" & Parameters
DIM Uninstall25x64 : Uninstall25x64 = "msiexec.exe /x {26A24AE4-039D-4CA4-87B4-2F86416025FF}" & Parameters
DIM Uninstall26 : Uninstall26 = "msiexec.exe /x {26A24AE4-039D-4CA4-87B4-2F83216026FF}" & Parameters
DIM Uninstall26x64 : Uninstall26x64 = "msiexec.exe /x {26A24AE4-039D-4CA4-87B4-2F86416026FF}" & Parameters
DIM Uninstall27 : Uninstall27 = "msiexec.exe /x {26A24AE4-039D-4CA4-87B4-2F83216027FF}" & Parameters
DIM Uninstall27x64 : Uninstall27x64 = "msiexec.exe /x {26A24AE4-039D-4CA4-87B4-2F86416027FF}" & Parameters
DIM Uninstall28 : Uninstall28 = "msiexec.exe /x {26A24AE4-039D-4CA4-87B4-2F83216028FF}" & Parameters
DIM Uninstall28x64 : Uninstall28x64 = "msiexec.exe /x {26A24AE4-039D-4CA4-87B4-2F86416028FF}" & Parameters
DIM Uninstall29 : Uninstall29 = "msiexec.exe /x {26A24AE4-039D-4CA4-87B4-2F83216029FF}" & Parameters
DIM Uninstall29x64 : Uninstall29x64 = "msiexec.exe /x {26A24AE4-039D-4CA4-87B4-2F86416029FF}" & Parameters
DIM Uninstall30 : Uninstall30 = "msiexec.exe /x {26A24AE4-039D-4CA4-87B4-2F83216030FF}" & Parameters
DIM Uninstall30x64 : Uninstall30x64 = "msiexec.exe /x {26A24AE4-039D-4CA4-87B4-2F86416030FF}" & Parameters
DIM Uninstall31 : Uninstall31 = "msiexec.exe /x {26A24AE4-039D-4CA4-87B4-2F83216031FF}" & Parameters
DIM Uninstall31x64 : Uninstall31x64 = "msiexec.exe /x {26A24AE4-039D-4CA4-87B4-2F86416031FF}" & Parameters
DIM Uninstall7_1 : Uninstall7_1 = "msiexec.exe /x {26A24AE4-039D-4CA4-87B4-2F83217001FF}" & Parameters
DIM Uninstall7_1x64 : Uninstall7_1x64 = "msiexec.exe /x {26A24AE4-039D-4CA4-87B4-2F86417001FF}" & Parameters
DIM Uninstall7_2 : Uninstall7_2 = "msiexec.exe /x {26A24AE4-039D-4CA4-87B4-2F83217002FF}" & Parameters
DIM Uninstall7_2x64 : Uninstall7_2x64 = "msiexec.exe /x {26A24AE4-039D-4CA4-87B4-2F86417002FF}" & Parameters
DIM Uninstall7_3 : Uninstall7_3 = "msiexec.exe /x {26A24AE4-039D-4CA4-87B4-2F83217003FF}" & Parameters
DIM Uninstall7_3x64 : Uninstall7_3x64 = "msiexec.exe /x {26A24AE4-039D-4CA4-87B4-2F86417003FF}" & Parameters
DIM Uninstall7_4 : Uninstall7_4 = "msiexec.exe /x {26A24AE4-039D-4CA4-87B4-2F83217004FF}" & Parameters
DIM Uninstall7_4x64 : Uninstall7_4x64 = "msiexec.exe /x {26A24AE4-039D-4CA4-87B4-2F86417004FF}" & Parameters
oShell.Run Uninstall01, 7, True
oShell.Run Uninstall02, 7, True
oShell.Run Uninstall03, 7, True
oShell.Run Uninstall04, 7, True
oShell.Run Uninstall05, 7, True
oShell.Run Uninstall06, 7, True
oShell.Run Uninstall07, 7, True
oShell.Run Uninstall08, 7, True
oShell.Run Uninstall09, 7, True
oShell.Run Uninstall10, 7, True
oShell.Run Uninstall11, 7, True
oShell.Run Uninstall12, 7, True
oShell.Run Uninstall13, 7, True
oShell.Run Uninstall14, 7, True
oShell.Run Uninstall15, 7, True
oShell.Run Uninstall16, 7, True
oShell.Run Uninstall17, 7, True
oShell.Run Uninstall18, 7, True
oShell.Run Uninstall19, 7, True
oShell.Run Uninstall20, 7, True
oShell.Run Uninstall21, 7, True
oShell.Run Uninstall22, 7, True
oShell.Run Uninstall23, 7, True
oShell.Run Uninstall23x64, 7, True
oShell.Run Uninstall24, 7, True
oShell.Run Uninstall24x64, 7, True
oShell.Run Uninstall25, 7, True
oShell.Run Uninstall25x64, 7, True
oShell.Run Uninstall26, 7, True
oShell.Run Uninstall26x64, 7, True
oShell.Run Uninstall27, 7, True
oShell.Run Uninstall27x64, 7, True
oShell.Run Uninstall28, 7, True
oShell.Run Uninstall28x64, 7, True
oShell.Run Uninstall29, 7, True
oShell.Run Uninstall29x64, 7, True
oShell.Run Uninstall30, 7, True
oShell.Run Uninstall30x64, 7, True
oShell.Run Uninstall31, 7, True
oShell.Run Uninstall31x64, 7, True
oShell.Run Uninstall7_1, 7, True
oShell.Run Uninstall7_1x64, 7, True
oShell.Run Uninstall7_2, 7, True
oShell.Run Uninstall7_2x64, 7, True
oShell.Run Uninstall7_3, 7, True
oShell.Run Uninstall7_3x64, 7, True
oShell.Run Uninstall7_4, 7, True
oShell.Run Uninstall7_4x64, 7, True
REM Cleanup Local Variables
Set oShell = Nothing
Set Parameters = Nothing
Set Uninstall01 = Nothing
Set Uninstall02 = Nothing
Set Uninstall03 = Nothing
Set Uninstall04 = Nothing
Set Uninstall05 = Nothing
Set Uninstall06 = Nothing
Set Uninstall07 = Nothing
Set Uninstall08 = Nothing
Set Uninstall09 = Nothing
Set Uninstall10 = Nothing
Set Uninstall11 = Nothing
Set Uninstall12 = Nothing
Set Uninstall13 = Nothing
Set Uninstall14 = Nothing
Set Uninstall15 = Nothing
Set Uninstall16 = Nothing
Set Uninstall17 = Nothing
Set Uninstall18 = Nothing
Set Uninstall19 = Nothing
Set Uninstall20 = Nothing
Set Uninstall21 = Nothing
Set Uninstall22 = Nothing
Set Uninstall23 = Nothing
Set Uninstall23x64 = Nothing
Set Uninstall24 = Nothing
Set Uninstall24x64 = Nothing
Set Uninstall25 = Nothing
Set Uninstall25x64 = Nothing
Set Uninstall26 = Nothing
Set Uninstall26x64 = Nothing
Set Uninstall27 = Nothing
Set Uninstall27x64 = Nothing
Set Uninstall28 = Nothing
Set Uninstall28x64 = Nothing
Set Uninstall29 = Nothing
Set Uninstall29x64 = Nothing
Set Uninstall30 = Nothing
Set Uninstall30x64 = Nothing
Set Uninstall31 = Nothing
Set Uninstall31x64 = Nothing
Set Uninstall7_1 = Nothing
Set Uninstall7_1x64 = Nothing
Set Uninstall7_2 = Nothing
Set Uninstall7_2x64 = Nothing
Set Uninstall7_3 = Nothing
Set Uninstall7_3x64 = Nothing
Set Uninstall7_4 = Nothing
Set Uninstall7_4x64 = Nothing
End Sub
'*******************************************************************************
Sub Installx86()
REM Define Local Objects
DIM oShell : SET oShell = CreateObject("Wscript.Shell")
REM Define Local Variables
DIM File : File = Chr(32) & RelativePath & "x86\jre1.7.0_04.msi"
DIM Parameters : Parameters = Chr(32) & "/qb- ADDLOCAL=ALL IEXPLORER=1 MOZILLA=1 SYSTRAY=1 JAVAUPDATE=1 JU=0 AUTOUPDATECHECK=1 /norestart"
DIM Install : Install = "msiexec.exe /i" & File & Parameters
oShell.Run Install, 1, True
REM Cleanup Local Variables
Set File = Nothing
Set Install = Nothing
Set oShell = Nothing
Set Parameters = Nothing
End Sub
'*******************************************************************************
Sub Installx64()
REM Define Local Objects
DIM oShell : SET oShell = CreateObject("Wscript.Shell")
REM Define Local Variables
DIM File : File = Chr(32) & RelativePath & "x64\jre1.7.0_04.msi"
DIM Parameters : Parameters = Chr(32) & "/qb- ADDLOCAL=ALL IEXPLORER=1 MOZILLA=1 SYSTRAY=1 JAVAUPDATE=1 JU=0 AUTOUPDATECHECK=1 /norestart"
DIM Install : Install = File & Parameters
oShell.Run Install, 1, True
REM Cleanup Local Variables
Set File = Nothing
Set Install = Nothing
Set oShell = Nothing
Set Parameters = Nothing
End Sub
'*******************************************************************************
Sub GlobalVariableCleanup()
Set Architecture = Nothing
Set LogFolder = Nothing
Set RelativePath = Nothing
End Sub