Install Adobe Reader 11 in the language of the OS

image_pdfimage_print

The client I am working for has a multi langual environment. The baseline applications should be available in English, French, German, Spanish and Italian. For each country there was a collection, package and advertisement in SCCM 2007. So a lot to maintain.

For Adobe 11 we decided to make it easier and I was asked to do so. So I made a ‘master package’ that contains all these languages. Depending on the language that the user has selected in Windows XP or Windows 7, Adobe Reader 11 is installed in that particular language.

The steps:

  • Downloaded the setup.exe for all the countries from the Adobe FTP Site.
  • With the Adobe Customization Wizard for Adobe Reader 11 I made all the transform files.
  • Download the latest patches from the Adobe FTP Site.
  • Modify the generated setup.ini:
    [Startup]
    RequireOS=Windows 2000
    RequireMSI=3.0
    RequireIE=6.0.2600.0
    CmdLine=/sall /rs
    
    [Product]
    msi=AcroRead.msi
    CmdLine=TRANSFORMS="Adobe_Reader_11.0.01_SPA_XP_P1.mst" /l*v c:\windows\system32\logfiles\Adobe_Reader_11.0.01_SPA_XP_P1.log
    PATCH=AdbeRdrUpd11001.msp
    
    [Windows 2000]
    PlatformID=2
    MajorVersion=5
    ServicePackMajor=4
    
    [MSI Updater]
    Path=http://ardownload.adobe.com/pub/adobe/reader/win/8.x/8.0/misc/WindowsInstaller-KB893803-v2-x86.exe
    
  • For each country I made a folder with the country abbreviation. ENG for English, GER for Germany and so on.
  • The installation script:
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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
' ================================================================================================
' Installs Adobe Reader 11.x.
' Created by Willem-Jan Vroom
' Version history:
'
' 0.0.1
'    Initial version'
'
' 1.0.0
'    Final version
'
' 2.0.0
'    Includes language detection on Windows 7
'
' 3.0.0
'    Includes the installation of the Japanese Font Pack (if needed) 
'
' 4.0.0
'    Sandbox Enhanced Security has been disabled.
'    (Sandboxing off)
'
' 5.0.0
'    Improved detection of current logged on userid.
'
' 6.0.0
'    The User SID was not resolved correctly on Windows XP.
' ================================================================================================
 
' ------------------------------------------------------------------------------------------------
' Declare the most variables. 
' ------------------------------------------------------------------------------------------------
 
  Option Explicit
 
  Dim objShell                          : set objShell                      = WScript.CreateObject("WScript.Shell")
  Dim objLogFileFSO                     : Set objLogFileFSO                 = CreateObject("Scripting.FileSystemObject")
  Dim objFSO                            : Set objFSO                        = CreateObject("Scripting.FileSystemObject")
  Dim objProcessEnv                     : Set objProcessEnv                 = objShell.Environment("PROCESS")
  Dim objWMIService                     : Set objWMIService                 = GetObject("winmgmts:\\.\root\cimv2")
  Dim fn_objWMIService                  : Set fn_objWMIService              = GetObject("winmgmts:\\.\root\cimv2")
  Dim objReg                            : Set objReg                        = GetObject("winmgmts:\\.\root\default:StdRegProv")
  Dim objLogFile
  Dim CurrentDir                        : CurrentDir                        = Left(Wscript.ScriptFullname, InstrRev(Wscript.ScriptFullname, "\"))
                                          CurrentDir                        = Left(CurrentDir,len(CurrentDir)-1)
  Dim strcomputerName                   : strcomputerName                   = objProcessEnv("COMPUTERNAME")
  Dim strLogLocation                    : strLogLocation                    = "C:\WINDOWS\system32\Logfiles"
  Dim strOutputFile                     : strOutputFile                     = strLogLocation & "\" & strcomputerName & "_Installation_Adobe_Reader_" & Replace(FormatDateTime(Now(), 2),"/","-") & ".log"
  Dim strArchitecture                   : strArchitecture                   = ""
  Dim strCurrentUser                    : strCurrentUser                    = ""
  Dim strCurrentUserSID                 : strCurrentUserSID                 = "" 
  Dim strOS                             : strOS                             = ""
  Dim strCommand                        : strCommand                        = ""
  Dim strLine                           : strLine                           = ""
  Dim strQuery                          : strQuery                          = ""
  Dim strCommonDesktop                  : strCommonDesktop                  = ""
  Dim strArray                          : strArray                          = ""  
  Dim strAppDataFolder                  : strAppDataFolder                  = ""
  Dim strProcess                        : strProcess                        = ""
  Dim strLanguage                       : strLanguage                       = ""
  Dim strInstallLanguage                : strInstallLanguage                = ""
  Dim strDetectUserUILanguage           : strDetectUserUILanguage           = ""
  Dim strValue                          : strValue                          = ""
  Dim strJapaneseFontPackMSI            : strJapaneseFontPackMSI            = CurrentDir & "\JapaneseFontPack\FontPack11000_XtdAlf_Lang.msi"
  Dim strKeyPath                        : strKeyPath                        = ""
  Dim strValueName                      : strValueName                      = ""
  Dim dwValue                           : dwValue                           = 0
 
  Dim arrFileNamesToKill                : arrFileNamesToKill                = Array("AcroRd32.exe", "iexplore.exe", "firefox.exe", "chrome.exe")
  Dim objFileNameToKill
 
  Dim arrArguments
  Dim arrLanguage
  Dim strDNSDomain                      : strDNSDomain                      = CreateObject("ADSystemInfo").DomainShortName
  Dim valCounter
  Dim valResult 
  Dim valReturnCode
 
  Dim colProcess, objProcess 
  Dim valOSBuildNumber
  Dim objSubfolder
  Dim colItems, objItem, Subfolder
  Dim colSoftware, objSoftware
  Dim arrValues
 
 
  Const ForWriting           = 2
  Const ForReading           = 1
  Const ForAppending         = 8
  Const OverWriteFiles       = True
  const HKEY_CURRENT_USER    = &H80000001
  const HKEY_LOCAL_MACHINE   = &H80000002
  Const HKEY_USERS           = &H80000003 
 
' ------------------------------------------------------------------------------------------------
' Create the log location (if not exists)
' Open the logfile.  
' ------------------------------------------------------------------------------------------------
 
  CreateFolderStructure(strLogLocation)
  OpenLogFile()
  WriteToLog "- ACTION: script started."
  WriteToLog " "
 
' ------------------------------------------------------------------------------------------------
' Detect the current OS.  
' ------------------------------------------------------------------------------------------------
 
  Set colItems = objWMIService.ExecQuery("Select Caption,BuildNumber from Win32_OperatingSystem")
  For Each objItem in colItems
      strOS            = objItem.Caption
      valOSBuildNumber = objItem.BuildNumber
  next
 
' ------------------------------------------------------------------------------------------------
' Find the currently logged on userid.
' And translate it to the users SID.
' ------------------------------------------------------------------------------------------------
 
  Set colProcess = objWMIService.ExecQuery("Select * from Win32_Process where Name = 'explorer.exe'")
  For Each objProcess in colProcess
      valReturnCode = objProcess.GetOwner(strCurrentUser)
      if valReturnCode <> 0 Then strCurrentUser = "Unable to find the username!"
  Next
 
  strCurrentUser = Ucase(strDNSDomain) & "\" & strCurrentUser
 
  strCurrentUserSID = GetSIDFromUser(strCurrentUser)
 
' ------------------------------------------------------------------------------------------------
' Detect the current processor architecture.  
' ------------------------------------------------------------------------------------------------
 
  if objFSO.FolderExits(objShell.ExpandEnvironmentStrings("%WinDir%") & "\SYSWow64") Then 
     strArchitecture = "x64"
       else
     strArchitecture = "x86"
  end if
 
' ------------------------------------------------------------------------------------------------
' Detect the current User Interface MUI.  
' ------------------------------------------------------------------------------------------------
 
  strDetectUserUILanguage = DetectUserUILanguage
 
  strInstallLanguage = ""
 
  if wscript.arguments.count > 0 Then
     Set arrArguments = wscript.arguments
     for valCounter = 0 to wscript.arguments.count - 1
        if instr(lcase(arrArguments(valCounter)),"/uselang=") > 0 Then
           arrLanguage = split(lcase(arrArguments(valCounter)),"=")
           strInstallLanguage = arrLanguage(1)
           strInstallLanguage = trim(lcase(strInstallLanguage))
        end if
     next
  end if
 
  if strInstallLanguage = "" Then 
     strInstallLanguage = strDetectUserUILanguage
  End if
 
  WriteToLog("########## Details regarding operating system and logged on user     ##########")
  WriteToLog("Found Operating System:       " & strOS)
  WriteToLog("Found architecture:           " & strArchitecture)
  WriteToLog("Logged on userid:             " & strCurrentUser)
  WriteToLog("Logged on user SID:           " & strCurrentUserSID)
  WriteToLog("User MUI Language:            " & strDetectUserUILanguage)
  WriteToLog("Reader will be installed in:  " & strInstallLanguage)
  WriteToLog("########## End details regarding operating system and logged on user ##########")
  WriteToLog(" ")
  WriteToLog("########## Installation                                              ##########")
 
 
  ' ------------------------------------------------------------------------------------------------
  ' Close applications that might screw up the installation.
  ' ------------------------------------------------------------------------------------------------ 
 
  For Each objFileNameToKill in arrFileNamesToKill 
     fnKillProcess(objFileNameToKill)
  Next
 
  ' ------------------------------------------------------------------------------------------------
  ' Start the installation
  ' ------------------------------------------------------------------------------------------------ 
 
  strCommand = CurrentDir & "\" & strInstallLanguage & "\setup.exe"
  if objFSO.FileExists(strCommand) Then
     strCommand = chr(34) & strCommand & chr(34)
     WriteToLog ("Running command: " & strCommand)
     valResult = objShell.Run (strCommand,6,True)
     if valResult = 0 or valResult = 3010 or valResult = 1603 then
        WriteToLog("SUCCES")
        valReturnCode = 0
        DisableSandboxing()
        InstallJapaneseFontPack()
         else
        WriteToLog("FAILURE")
        valReturnCode = 9999
     end if
      else
     WriteToLog("The file '" & strCommand & "' does not exists!")
  end if
  WriteToLog("########## End Installation                                          ##########")
  WriteToLog(" ")
  CloseLogFile()
  wscript.quit valReturnCode
 
Sub DisableSandboxing()
 
' ------------------------------------------------------------------------------------------------
' Subroutine: DisableSandboxing()
' Switches the Adobe Sandboxing off.
' ------------------------------------------------------------------------------------------------
 
  strKeyPath      = "SOFTWARE\Policies\Adobe\Acrobat Reader\11.0\FeatureLockDown"
  strValueName    = "bProtectedMode"
  dwValue         = 0
 
  If ValueExists("bProtectedMode","SOFTWARE\Policies\Adobe\Acrobat Reader\11.0\FeatureLockDown\") Then
     objReg.DeleteValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName
     objReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue
     WriteToLog "Value '" & strValueName & "' in 'HKEY_LOCAL_MACHINE\" & strKeyPath & "' existed... removed and recreated."
      Else 
     objReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue
     WriteToLog "Value '" & strValueName & "' in 'HKEY_LOCAL_MACHINE\" & strKeyPath & "' didn't exist... now created."
  End If
 
End Sub
 
 
Sub InstallJapaneseFontPack()
 
' ------------------------------------------------------------------------------------------------
' Subroutine: InstallJapaneseFontPack()
' Installs the Japanese Font Pack if not already installed.
' ------------------------------------------------------------------------------------------------
 
  WriteToLog("########## Installation Japanese Font Pack                           ##########")
  if NOT fnCheckIsMSIInstalled(strJapaneseFontPackMSI) Then
     strCommand = "msiexec /i " & chr(34) & strJapaneseFontPackMSI & chr(34) & " /qn ADDLOCAL=Common,JapaneseLanguagePack /l*v c:\windows\system32\LogFiles\AdobeReaderJapaneseFontPack.log"
     WriteToLog("Running command: " & strCommand)
     valResult = objShell.Run (strCommand,6,True)
     if valResult = 0 or valResult = 3010 or valResult = 1603 then
        WriteToLog("SUCCESS")
         else
        WriteToLog("FAILURE")
     end if
      else
     WriteToLog("The Fontpacks have already been installed, thus skipping.")
  end if
 
  WriteToLog("########## End installation Japanese Font Pack                       ##########")
End sub
 
 
Sub OpenLogFile() 
 
' ------------------------------------------------------------------------------------------------
' Subroutine: OpenLogFile() 
' The name of the logfile is mentinoed in the variabele strOutputFile.
' ------------------------------------------------------------------------------------------------
 
  If objLogFileFSO.FileExists(strOutputFile) Then
     Set objLogFile = objLogFileFSO.OpenTextFile(strOutputFile, ForWriting)
         Else
     Set objLogFile = objLogFileFSO.CreateTextFile(strOutputFile)
  End If
 
End Sub
 
Sub CloseLogFile()
 
' ------------------------------------------------------------------------------------------------
' Subroutine: CloseLogFile()
' Close the log file.
' ------------------------------------------------------------------------------------------------
 
  WriteToLog "- ACTION: script ended."
  objLogFile.Close
  Set objLogfileFSO = Nothing
 
End Sub
 
Function WriteToLog(sLogMessage)
 
' ------------------------------------------------------------------------------------------------
' Function: WriteToLog(sLogMessage)
' Writes an entry 'sLogMessage' in the logfile.
' ------------------------------------------------------------------------------------------------
 
  if instr(sLogMessage, "- ACTION: ") = 0 then sLogMessage = "          " & sLogMessage
  objLogFile.WriteLine("Time: " & now & "  " & sLogMessage)
 
End Function
 
Function GetSIDFromUser(UserName)
 
' ------------------------------------------------------------------------------------------------
' Function: GetSIDFromUser(UserName)
' Gets the SID from the give username.
' We use the registry to avoid an empty result if run under the SYSTEM account.
' ------------------------------------------------------------------------------------------------
 
  Dim DomainName, Result, WMIUser
 
  If InStr(UserName, "\") > 0 Then
    DomainName = Mid(UserName, 1, InStr(UserName, "\") - 1)
    UserName = Mid(UserName, InStr(UserName, "\") + 1)
  Else
    DomainName = CreateObject("WScript.Network").UserDomain
  End If
 
  On Error Resume Next
  Set WMIUser = GetObject("winmgmts:{impersonationlevel=impersonate}!" _
    & "/root/cimv2:Win32_UserAccount.Domain='" & DomainName & "'" _
    & ",Name='" & UserName & "'")
  If Err.Number = 0 Then
    Result = WMIUser.SID
  Else
    Result = ""
  End If
  On Error GoTo 0
 
  GetSIDFromUser = Result
 
End Function
 
Sub CreateFolderStructure(strFolderNameToBeCreated)
 
' ------------------------------------------------------------------------------------------------
' Subroutine: CreateFolderStructure(strFolderNameToBeCreated)
' Creates the map as mentioned in strFolderNameToBeCreated.
' ------------------------------------------------------------------------------------------------
 
  Dim arrFoldersTMP : arrFoldersTMP = split (strFolderNameToBeCreated,"\")
  Dim strFolder  : strFolder  = ""
  Dim objFolderTMP
 
  For Each objFolderTMP in arrFoldersTMP
      strFolder = strFolder & objFolderTMP
      If NOT objFSO.FolderExists(strFolder) Then
             objFSO.CreateFolder(strFolder)
      end If
      strFolder = strFolder & "\"
  Next
 
End Sub
 
Function DetectUserUILanguage
 
' ------------------------------------------------------------------------------------------------
' Function: DetectUserUILanguage
' Detects the User Interface Language 
' ------------------------------------------------------------------------------------------------
 
  if instr(lcase(strOS),"windows xp") > 0 then
     strKeyPath               = strCurrentUserSID & "\Control Panel\Desktop"
     strValueName             = "MultiUILanguageId"
     strLanguage              = "eng"
     objReg.GetStringvalue HKEY_USERS,strKeyPath,strValueName,strValue
     if NOT IsEmpty(strValue) Then
        strValue = UCase(right(strValue,4))
        if strValue = "040C" then strLanguage = "fra"
        if strValue = "0410" then strLanguage = "ita"
        if strValue = "0407" then strLanguage = "ger"
        if strValue = "040A" then strLanguage = "spa"
        if strValue = "0C0A" then strLanguage = "spa"
     end if
      else
     strKeyPath               = strCurrentUserSID & "\Control Panel\Desktop"
     strValueName             = "PreferredUILanguages"
     strLanguage              = "eng"
     objReg.GetMultiStringValue HKEY_USERS,strKeyPath,strValueName,arrValues
     if not IsNull(arrValues) Then
        strValue=arrValues(0)
        if NOT IsEmpty(strValue) then
           strValue = lcase(left(strValue,5))
           if strValue = "fr-fr" then strLanguage = "fra"
           if strValue = "it-it" then strLanguage = "ita"
           if strValue = "de-de" then strLanguage = "ger"
           if strValue = "es-es" then strLanguage = "spa"
        end if
     end if
     if strLanguage = "eng" then
        strKeyPath               = ".DEFAULT\Control Panel\Desktop\MuiCached"
        strValueName             = "MachinePreferredUILanguages"
        objReg.GetMultiStringValue HKEY_USERS,strKeyPath,strValueName,arrValues
        if not IsNull(arrValues) Then
           strValue=arrValues(0)
           if NOT IsEmpty(strValue) then
              strValue = lcase(left(strValue,5))
              if strValue = "fr-fr" then strLanguage = "fra"
              if strValue = "it-it" then strLanguage = "ita"
              if strValue = "de-de" then strLanguage = "ger"
              if strValue = "es-es" then strLanguage = "spa"
           end if
        end if
     end if     
  end if
 
  ' ------------------------------------------------------------------------------------------------
  ' This query is needed to find Japanese systems
  ' ------------------------------------------------------------------------------------------------
 
  Set colSoftware = objWMIService.ExecQuery("Select * from Win32_Product Where Name LIKE '%Microsoft Office Word MUI (Japanese) 2010%'")
  For Each objSoftware in colSoftware
      strLanguage = "jpn"
  Next
 
  DetectUserUILanguage = strLanguage
End Function
 
Function fnKillProcess(strProcessName)
 
' ------------------------------------------------------------------------------------------------
' Function: fnKillProcess(strProcessName)
' Terminates the given processname.
' ------------------------------------------------------------------------------------------------
 
  Set colProcess = fn_objWMIService.ExecQuery ("Select * From Win32_Process")
  For Each objProcess In colProcess
    If Instr(LCase(objProcess.Name),LCase(strProcessName)) > 0 Then
       objShell.Run "TASKKILL /F /T /IM " & objProcess.Name, 0, False
       objProcess.Terminate()
       WriteToLog("Terminating application: " & objProcess.Name)
    End If
  Next
 
End Function
 
Function fnCheckIsMSIInstalled(strMSIName)
 
  ' -----------------------------------------------------------------------------------------------------------------
  ' Function: fnCheckIsMSIInstalled(strMSIName)
  ' Checks if the MSI given in strMSIName has been installed.
  ' strMSIName = "\\server\share\path\to\install.msi"
  ' This script is based on the example in 
  ' http://www.pcreview.co.uk/forums/getting-property-info-via-vbscript-text-file-t1544137.html
  ' -----------------------------------------------------------------------------------------------------------------
 
  Dim fn_objFSO    : Set fn_objFSO = CreateObject("Scripting.FileSystemObject")
  Dim fn_objWI     : Set fn_objWI  = CreateObject("WindowsInstaller.Installer")
 
  Dim fn_objReg    : Set fn_objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
  Dim strKeyPath   : strKeyPath    = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
  Dim strValueName : strValueName  = "InstallDate"
 
  ' -----------------------------------------------------------------------------------------------------------------
  ' check if the file exists and that the given file is a MSI
  ' -----------------------------------------------------------------------------------------------------------------
 
  If NOT fn_objFSO.FileExists(strMSIName) then
     ' --------------------------------------------------------------------------------------------------------------
     ' Leave the function and clean up the mess.
     ' --------------------------------------------------------------------------------------------------------------
     fnCheckIsMSIInstalled = False
     Set fn_objFSO     = Nothing
     Set fn_objWI      = Nothing
     Set fn_objReg     = Nothing
     Exit Function
  End If
  If lcase(right(strMSIName,3)) <> "msi" then
     ' --------------------------------------------------------------------------------------------------------------
     ' Leave the function and clean up the mess.
     ' --------------------------------------------------------------------------------------------------------------
     fnCheckIsMSIInstalled = False
     Set fn_objFSO     = Nothing
     Set fn_objWI      = Nothing
     Set fn_objReg     = Nothing
     Exit Function
  End If
 
  ' -----------------------------------------------------------------------------------------------------------------
  ' Find the property 'ProductCode' in the given MSI
  ' -----------------------------------------------------------------------------------------------------------------
 
  Dim fn_objDB     : Set fn_objDB   = fn_objWI.OpenDatabase(strMSIName,2)
  Dim fn_objView   : Set fn_objView = fn_objDB.OpenView("Select `Value` From Property WHERE `Property` ='ProductCode'")
  fn_objView.Execute
  Dim fn_objRec    : Set fn_objRec  = fn_objView.Fetch
  If fn_objRec is Nothing Then
     ' --------------------------------------------------------------------------------------------------------------
     ' Leave the function and clean up the mess.
     ' --------------------------------------------------------------------------------------------------------------
     fnCheckIsMSIInstalled = False
     Set fn_objFSO     = Nothing
     Set fn_objWI      = Nothing
     Set fn_objReg     = Nothing
     Set fn_objDB      = Nothing
     Set fn_objView    = Nothing
     Set fn_objRec     = Nothing
     Exit Function
  End If
  Dim strProductCode : strProductCode = fn_objRec.StringData(1)
 
  ' -----------------------------------------------------------------------------------------------------------------
  ' Check that the key InstallDate in the hive HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{ProductCode} 
  ' exists
  ' -----------------------------------------------------------------------------------------------------------------
 
  strKeyPath = strKeyPath & strProductCode
  fn_objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
  if IsNull(strValue) then 
     fnCheckIsMSIInstalled = False
       else
     fnCheckIsMSIInstalled = True
  end if
 
  Set fn_objFSO     = Nothing
  Set fn_objWI      = Nothing
  Set fn_objReg     = Nothing
  Set fn_objDB      = Nothing
  Set fn_objView    = Nothing
  Set fn_objRec     = Nothing
 
End Function
 
Function KeyExists(Key, KeyPath)
 
' ------------------------------------------------------------------------------------------------
' Function: KeyExists(Key, KeyPath)
' Checks to see if the 'Key' in 'KeyPath' exists.
' ------------------------------------------------------------------------------------------------
 
  Dim arrSubKeys
  Dim i
  Dim regReadResult : regReadResult = objReg.EnumKey(HKEY_LOCAL_MACHINE, KeyPath, arrSubKeys)
 
 
  KeyExists = False
 
  If regReadResult = 0 And IsArray(arrSubKeys) Then
     For i = 0 To UBound(arrSubKeys)
         If InStr(arrSubKeys(i), Key) <> 0 Then
       	    KeyExists = True
    	    i = UBound(arrSubKeys)
	 End If
     Next	
  End If
 
End Function
 
Function ValueExists(Key, KeyPath)
 
' ------------------------------------------------------------------------------------------------
' Function: ValueExists(Key, KeyPath)
' Checks to see if the value 'Key' in 'KeyPath' exists.
' ------------------------------------------------------------------------------------------------
 
  Dim arrSubValues
  Dim i
  Dim regReadResult : regReadResult = objReg.EnumValues(HKEY_LOCAL_MACHINE, KeyPath, arrSubValues)
 
 
  ValueExists = False
 
  If regReadResult = 0 And IsArray(arrSubValues) Then
     For i = 0 To UBound(arrSubValues)
         If InStr(arrSubValues(i), Key) <> 0 Then
    	    ValueExists = True
    	    i = UBound(arrSubValues)
         End If
     Next	
  End If
 
End Function

Permanent link to this article: https://www.vroom.cc/wordpress/adobe-reader-11-and-more-languages/