Jan
Finally, after a long holiday, a new blog post and script again.
The script below is a very neat script which does a full silent (unattended) install of the Oracle Webclient / Siebel Mobile Client and kills the predeploy.htm! There aren’t much scripts on the internet which can do it like this script does.
Apart from some minor changes, the script is mainly written by a colleague of mine (who likes to stay low on the radar
). The script was written because a silent install was needed in the project we are working on. Oracle doesn’t support a silent install, therefore we had to write it ourselves (Oracle is lightyears behind with all kinds of stuff by the way).
Note #1: Change the
Note #2: The script uses different kind of hta files, to give output / status information. These are just basic hta files. If you want an example, please contact me.
install_oracle_webclient.vbs (silent + kill predeploy.htm)
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 567 568 569 | ''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' AUTHOR : http://www.hican.net - @hicannet ' DATE : 17-01-2012 ' COMMENT : This script installs the Oracle / Siebel ' webclient and it kills the predeploy.htm ''''''''''''''''''''''''''''''''''''''''''''''''''''''' Set objShell = CreateObject("Wscript.Shell") Set objFSO = CreateObject("Scripting.FileSystemObject") Set objLogFileFSO = CreateObject("Scripting.FileSystemObject") Set wshSystemEnv = objShell.Environment("SYSTEM") Set objProcessEnv = objShell.Environment("PROCESS") Set objReg = GetObject("winmgmts:{impersonationLevel=" _ & "impersonate}!\\.\root\default:StdRegProv") Set objWMIService = GetObject("winmgmts:\\.\root\cimv2") CurrentDir = Left(Wscript.ScriptFullname, InstrRev(Wscript.ScriptFullname, "\")) strLogLocation = objShell.ExpandEnvironmentStrings("%WinDir%") _ & "\system32\logfiles" Const SilentParam = " /qb!" Const AllUsers = " ALLUSERS=1" Const HKEY_LOCAL_MACHINE = &H80000002 Const ForWriting = 2 Const ForReading = 1 Const ForAppending = 8 Const OverWriteFiles = True CreateFolderStructure(strLogLocation) strLogLocation = strLogLocation & "\" strSiebelInstallLogFile = strLogLocation & "Siebel_Web_Client_" _ & Replace(FormatDateTime(Now(), 2),"/","-") & ".log" If objLogFileFSO.FileExists(strSiebelInstallLogFile) Then Set objLogFile = objLogFileFSO.OpenTextFile(strSiebelInstallLogFile, ForWriting) Else Set objLogFile = objLogFileFSO.CreateTextFile(strSiebelInstallLogFile) End If strremoteServerMobileClient = "<IP_ADDRESS>" strORACLE_HOME = "C:\Siebel\8.1\Client_1" strORACLE_HOME_NAME = "Siebel8_home1" strINVENTORY_LOCATION = strLogLocation & "Siebel_Web_Client_" _ & Replace(FormatDateTime(Now(), 2),"/","-") strArchitecture = "" strOperatingSystemCaption = "" strOperatingSystemVersion = "" ' ------------------------------------------------------------------------------ ' Find the processor architecture ' ------------------------------------------------------------------------------ Set colItems = objWMIService.ExecQuery("Select Architecture from Win32_Processor") For Each objItem In colItems If objItem.Architecture = 0 Then strArchitecture = "x86" If objItem.Architecture = 9 Then strArchitecture = "x64" Next ' ------------------------------------------------------------------------------ ' Step 1: Checks the prerequisites. Windows Vista (and above) is not supported ' by Oracle. ' ------------------------------------------------------------------------------ PrerequisiteChecks ' Avoid the File Open dialog. objProcessEnv("SEE_MASK_NOZONECHECKS") = 1 ' ------------------------------------------------------------------------------ ' Step 2: Install ActivePerl ' ------------------------------------------------------------------------------ InstallActivePerl ' ------------------------------------------------------------------------------ ' Step 3: Force shutdown of internet explorer ' ------------------------------------------------------------------------------ WriteToLog "Action: -> Executing: Kill both IE and Java processes (if running)" fnKillProcess("iexplore.exe") fnKillProcess("java.exe") fnKillProcess("javaw.exe") fnKillProcess("mshta.exe") ' ------------------------------------------------------------------------------ ' Step 4: Install the Oracle Web Client 8.1 Silent ' ------------------------------------------------------------------------------ InstallOracleWebClient81Silent ' ------------------------------------------------------------------------------ ' Step 5: Install the Oracle Web Client 8.1.1.3 Silent ' ------------------------------------------------------------------------------ InstallOracleWebClient8113Silent ' ------------------------------------------------------------------------------ ' Step 6: Set the ORACLE_HOME system environment variable ' Step 7: Modify the PATH system and process environment variable. ' ------------------------------------------------------------------------------ ModifyEnvironmentVariables ' ------------------------------------------------------------------------------ ' Step 8: Copy the Oracle Patches to a folder under ORACLE_HOME ' Step 9: Run 'OPatch' to upgrade the installation ' ------------------------------------------------------------------------------ InstallOraclePatches ' ------------------------------------------------------------------------------ ' Step 10: Modify the start menu ' ------------------------------------------------------------------------------ ModifyStartMenu ' ------------------------------------------------------------------------------ ' Step 11: Predeploy all the ocx, dll files for Internet Explorer. Also process ' the .inf files. ' ------------------------------------------------------------------------------ PredeployOracleCABFiles PredeployOracleINFFiles WriteToLog "-------------------------------------------------------------------" WriteToLog "Installation has completed." WriteToLog "-------------------------------------------------------------------" objProcessEnv.Remove("SEE_MASK_NOZONECHECKS") fnKillProcess("mshta.exe") Sub PrerequisiteChecks ' ------------------------------------------------------------------------------ ' Subroutine: PrerequisiteChecks ' Checks the OS version. If Windows 7 (or higher) then quit. ' ------------------------------------------------------------------------------ ' ------------------------------------------------------------------------------ ' Step 1: find the OS version ' ------------------------------------------------------------------------------ Set colItems = objWMIService.ExecQuery("Select Version from Win32_OperatingSystem") For Each objItem In colItems strOperatingSystemVersion = objItem.Version Next ' ------------------------------------------------------------------------------ ' Step 2: find the OS Caption ' ------------------------------------------------------------------------------ Set colItems = objWMIService.ExecQuery("Select Caption from Win32_OperatingSystem") For Each objItem In colItems strOperatingSystemCaption = objItem.caption Next strMessage = "Found OS '" & strOperatingSystemCaption & _ "' (" & strOperatingSystemVersion & ") (" & strArchitecture & ")" WriteToLog strMessage If Left(strOperatingSystemVersion,1) > 5 Then strMessage = "The OS '" & strOperatingSystemCaption & _ "' is not supported by Oracle. The installation will be aborted." WriteToLog strMessage MsgBox strMessage,16,"Oracle Web Client" WScript.Quit End If End Sub Sub ShowHTA(strHTAFile) ' ------------------------------------------------------------------------------ ' Subroutine: ShowHTA(strHTAFile) ' Shows a HTA file on the screen. ' trHTAFile = "c:\folder\folder1\folder2\filename.hta" ' ------------------------------------------------------------------------------ fnKillProcess("mshta.exe") strCommand = Chr(34) & strHTAFile & Chr(34) WriteToLog "Action: -> Executing: " & Chr(34) & strHTAFile & Chr(34) objshell.run Chr(34) & strHTAFile & Chr(34),0,False End Sub Sub CreateFolderStructure(strFolderNameToBeCreated) ' ------------------------------------------------------------------------------ ' Subroutine: CreateFolderStructure(strFolderNameToBeCreated) ' Creates the folderstructure as mentioned. Do not add a trailing '\' ' strFolderNameToBeCreated = "c:\folder\folder1\folder2" ' ------------------------------------------------------------------------------ Dim arrFolders : arrFolders = split (strFolderNameToBeCreated,"\") Dim strFolder : strFolder = "" Dim objFolder For Each objFolder In arrFolders strFolder = strFolder & objFolder If NOT objFSO.FolderExists(strFolder) Then objFSO.CreateFolder(strFolder) End If strFolder = strFolder & "\" Next End Sub Function fnKillProcess(strProcessName) ' ------------------------------------------------------------------------------ ' Function: fnKillProcess(strProcessName) ' Terminates the given processname. ' ------------------------------------------------------------------------------ Set fn_objWMIService = GetObject("winmgmts:{impersonationLevel=" _ & "impersonate}!\\.\root\cimv2") Set colProcess = fn_objWMIService.ExecQuery ("Select * From Win32_Process") For Each objProcess In colProcess If LCase(objProcess.Name) = LCase(strProcessName) Then objProcess.Terminate() End If Next End Function Function fn_WaitForProcessToStart(strProcessName) ' ------------------------------------------------------------------------------ ' Function: fn_WaitForProcessToStart(strProcessName) ' This function waits for a process to start. If the given processname is ' running, then the function is quit. ' strProcessName = the process to be checked. ' ------------------------------------------------------------------------------ blnProcessFound = False Set fn_objSWbemServices = GetObject("winmgmts:\\.\root\cimv2") Do WScript.Sleep 2500 Set colSWbemObjectSet = fn_objSWbemServices.InstancesOf("Win32_Process") For Each objSWbemObject In colSWbemObjectSet If (LCase(objSWbemObject.Name) = LCase(strProcessName)) Then blnProcessFound = True End If Next Loop Until blnProcessFound End Function Function fn_WaitForARunningProcess(strProcessName) ' ------------------------------------------------------------------------------ ' Function: fn_WaitForARunningProcess(strProcessName) ' This function waits for a process to stop. When the processname is not ' running anymore, this function will quit. ' strProcessName = the process to be checked. ' ------------------------------------------------------------------------------ Set fn_objSWbemServices = GetObject("winmgmts:\\.\root\cimv2") Set colSWbemObjectSet = fn_objSWbemServices.InstancesOf("Win32_Process") For Each objSWbemObject In colSWbemObjectSet If (LCase(objSWbemObject.Name) = LCase(strProcessName)) Then Wscript.Sleep(2500) fn_WaitForARunningProcess(strProcessName) End If Next End Function Function WriteToLog(sLogMessage) ' ------------------------------------------------------------------------------ ' Function: WriteToLog(sLogMessage) ' This function writes an entry in a log file. ' sLogMessage = The message to be written in the log file. ' ------------------------------------------------------------------------------ objLogFile.WriteLine("Time: " & now & " " & sLogMessage) End Function Function fnWriterunningProcessesToLogFile() ' ------------------------------------------------------------------------------ ' Function: fnWriterunningProcessesToLogFile ' Writes all the running processes to a log file. ' ------------------------------------------------------------------------------ Set fn_objWMIService = GetObject("winmgmts:{impersonationLevel=" _ & "impersonate}!\\.\root\cimv2") Set colProcess = fn_objWMIService.ExecQuery ("Select * From Win32_Process") For Each objProcess In colProcess WriteToLog(" --> Running process: " & objProcess.Name) Next End Function ' ------------------------------------------------------------------------------ ' The following subroutines are used to install the components. ' ------------------------------------------------------------------------------ Sub InstallActivePerl ' ------------------------------------------------------------------------------ ' Sub InstallActivePerl ' Only installs ActivePerl if not already installed. ' Use WMI to find the processor architecture. ' The variable %PROCESSOR_ARCHITECTURE% always returns x86 (under sytem ' context). That is why WMI is used. ' ------------------------------------------------------------------------------ If strArchitecture = "x86" Then strMSIFileName = CurrentDir & "1-ActivePerl" & Chr(92) _ & "ActivePerl-5.14.2.1402-MSWin32-x86-295342.msi" strLogfile = "ActivePerl-5.14.2.1402-MSWin32-x86-295342.log" strExecuteCommand = "msiexec.exe /i " & Chr(34) & strMSIFileName _ & Chr(34) & SilentParam & Allusers & " /l*v " _ & Chr(34) & strLogLocation & strLogfile & Chr(34) WriteToLog "Action: -> Executing: " & strExecuteCommand objShell.Run strExecuteCommand,0,True End If If strArchitecture = "x64" Then strMSIFileName = CurrentDir & "1-ActivePerl" & Chr(92) _ & "ActivePerl-5.14.2.1402-MSWin32-x64-295342.msi" strLogfile = "ActivePerl-5.14.2.1402-MSWin32-x64-295342.log" strExecuteCommand = "msiexec.exe /i " & Chr(34) & strMSIFileName & Chr(34) _ & SilentParam & Allusers & " /l*v " & Chr(34) _ & strLogLocation & strLogfile & Chr(34) WriteToLog "Action: -> Executing: " & strExecuteCommand objShell.Run strExecuteCommand,0,True End If End Sub Sub InstallOracleWebClient81Silent ' ------------------------------------------------------------------------------ ' Sub InstallOracleWebClient81Silent ' Installs the Oracle Web Client 8.1 ' ------------------------------------------------------------------------------ ShowHTA(CurrentDir & "step_1_Installing_8.1.hta") strFROM_LOCATION = CurrentDir & "2-8.1\Siebel_Web_Client\Disk1\stage\products.xml" strExecuteCommand = Chr(34) & CurrentDir _ & "2-8.1\Siebel_Web_Client\Disk1\install\oui.exe" & Chr(34) _ & " -ignoreSysPrereqs -noconsole -silent -nowait -force" _ & " -responseFile " & Chr(34) & CurrentDir _ & "6-RSPFiles\Siebel81.rsp" & Chr(34) _ & " FROM_LOCATION=" & Chr(34) & strFROM_LOCATION & Chr(34) _ & " remoteServerMobileClient=" & Chr(34) _ & strremoteServerMobileClient & Chr(34) & " ORACLE_HOME=" _ & Chr(34) & strORACLE_HOME & Chr(34) & " ORACLE_HOME_NAME=" _ & Chr(34) & strORACLE_HOME_NAME & Chr(34) _ & " INVENTORY_LOCATION=" & Chr(34) & strINVENTORY_LOCATION _ & Chr(34) WriteToLog "Action: -> Executing: " & strExecuteCommand blnResult = objShell.Run (strExecuteCommand) WriteToLog "Action: -> Now wait for Internet Explorer screen to come up" fn_WaitForProcessToStart("iexplore.exe") WriteToLog "Action: -> Executing: Kill Internet Explorer process" fnKillProcess ("iexplore.exe") WriteToLog "Action: -> Now wait for Java to finish." ' If run without the -noconsole parameter, then wait for java.exe fn_WaitForARunningProcess("javaw.exe") End Sub Sub InstallOracleWebClient8113Silent ' ------------------------------------------------------------------------------ ' Sub InstallOracleWebClient8113Silent ' Installs the Oracle Web Client 8.1.1.3 ' ------------------------------------------------------------------------------ ShowHTA(CurrentDir & "step_2_Installing_8.1.1.3.hta") strFROM_LOCATION = CurrentDir _ & "3-8.1.1.3\Client\Siebel_Web_Client\Disk1\stage\products.xml" strExecuteCommand = Chr(34) & CurrentDir _ & "3-8.1.1.3\Client\Siebel_Web_Client\Disk1\install\oui.exe" _ & Chr(34) & " -ignoreSysPrereqs -noconsole -silent -nowait" _ & " -force -responseFile " & Chr(34) & CurrentDir _ & "6-RSPFiles\Siebel8113.rsp" & Chr(34) _ & " FROM_LOCATION=" & Chr(34) & strFROM_LOCATION & Chr(34) _ & " ORACLE_HOME=" & Chr(34) & strORACLE_HOME & Chr(34) _ & " ORACLE_HOME_NAME=" & Chr(34) & strORACLE_HOME_NAME _ & Chr(34) & " INVENTORY_LOCATION=" & Chr(34) _ & strINVENTORY_LOCATION & Chr(34) WriteToLog "Action: -> Executing: " & strExecuteCommand blnResult = objShell.Run (strExecuteCommand) WriteToLog "Action: -> Wait for Oracle Universal Installer and Java to finish." fn_WaitForARunningProcess("oui.exe") WScript.Sleep 10000 'If run without the -noconsole parameter, then wait for java.exe fn_WaitForARunningProcess("javaw.exe") End Sub Sub ModifyEnvironmentVariables ' ------------------------------------------------------------------------------ ' Sub ModifyEnvironmentVariables ' Modifies the System Environment variables. ' ------------------------------------------------------------------------------ wshSystemEnv("ORACLE_HOME") = strORACLE_HOME WriteToLog "The system environment value 'ORACLE_HOME' has been set to " _ & strORACLE_HOME strPATH = wshSystemEnv("PATH") WriteToLog "The system environment variable PATH has as value: " & strPATH If InStr(strPATH,"perl") = 0 Then wshSystemEnv("PATH")="C:\Perl\bin;" & strPATH WriteToLog "The system environment variable PATH has been modified. The " _ & "new value is " & wshSystemEnv("PATH") Else WriteToLog "The system environment variable PATH has not been modified." End If End Sub Sub InstallOraclePatches ' ------------------------------------------------------------------------------ ' Sub InstallOraclePatches ' Copies the files to ORACLE_HOME. Then installs 2 oracle Patches. ' ------------------------------------------------------------------------------ ShowHTA(CurrentDir & "step_3_Copy_files.hta") objFSO.CopyFolder CurrentDir & "4-QF0312" , strORACLE_HOME & "\",OverWriteFiles objFSO.CopyFolder CurrentDir & "5-QF1302" , strORACLE_HOME & "\",OverWriteFiles objFSO.CopyFile CurrentDir & "6-RSPFiles\ocm.rsp" , strORACLE_HOME _ & "\",OverWriteFiles ShowHTA(CurrentDir & "step_4_Installing_Patch_QF0312.hta") strCommand = "c:\Perl\bin\perl.exe " & strORACLE_HOME _ & "\4-QF0312\Siebel_Web_Client\OPatch\opatch.pl apply " _ & strORACLE_HOME & "\4-QF0312\Siebel_Web_Client -silent -force " _ & "-ocmrf " & strORACLE_HOME & "\ocm.rsp -oh " & strORACLE_HOME WriteToLog "Action: -> Executing: 'objShell.Run " & strCommand & ",0,True'" objShell.Run strCommand,0,True ShowHTA(CurrentDir & "step_5_Installing_Patch_QF1302.hta") strCommand = "c:\Perl\bin\perl.exe " & strORACLE_HOME _ & "\5-QF1302\Siebel_Web_Client\OPatch\opatch.pl apply " _ & strORACLE_HOME & "\5-QF1302\Siebel_Web_Client -silent -force " _ & "-ocmrf " & strORACLE_HOME & "\ocm.rsp -oh " & strORACLE_HOME WriteToLog "Action: -> Executing: 'objShell.Run " & strCommand & ",0,True'" objShell.Run strCommand,0,True End Sub Sub ModifyStartMenu ' ------------------------------------------------------------------------------ ' Sub ModifyStartMenu ' Removes all unneeded entries from the Start menu and add one shortcut. ' ------------------------------------------------------------------------------ ShowHTA(CurrentDir & "step_6_Modifying_start_menu.hta") strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" strValueName = "Common Programs" objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strCommonPrograms If objFSO.FolderExists (strCommonPrograms & "\ActivePerl 5.14.2 Build 1402") Then WriteToLog "Action: -> Deleting: " & strCommonPrograms _ & "\ActivePerl 5.14.2 Build 1402" objFSO.DeleteFolder (strCommonPrograms & "\ActivePerl 5.14.2 Build 1402") End If If objFSO.FolderExists (strCommonPrograms & "\Oracle - " & strORACLE_HOME_NAME) Then WriteToLog "Action: -> Deleting: " & strCommonPrograms & "\Oracle - " _ & strORACLE_HOME_NAME objFSO.DeleteFolder (strCommonPrograms & "\Oracle - " & strORACLE_HOME_NAME) End If If objFSO.FolderExists (strCommonPrograms & Chr(92) & strORACLE_HOME_NAME) Then WriteToLog "Action: -> Deleting: " & strCommonPrograms & "\" & strORACLE_HOME_NAME objFSO.DeleteFolder (strCommonPrograms & "\" & strORACLE_HOME_NAME) End If Set objLink = objShell.CreateShortcut(strCommonPrograms _ & "\Siebel Field Service - ENU.lnk") objLink.Description = "Siebel Field Service - ENU" objLink.IconLocation = strORACLE_HOME & "\bin\siebel.exe,0" objLink.TargetPath = strORACLE_HOME & "\bin\siebel.exe" objLink.Arguments = "/c " & strORACLE_HOME & "\bin\enu\sfs.cfg" objLink.WindowStyle = 1 objLink.WorkingDirectory = strORACLE_HOME & "\bin" objLink.Save WriteToLog "Action: -> Created: icon 'Siebel Field Service - ENU' in " _ & strCommonPrograms End Sub Sub PredeployOracleCABFiles ' ------------------------------------------------------------------------------ ' Sub PredeployOracleCABFiles ' Extracts all the cab files to C:\Windows\Downloaded Program Files. ' Then the files are registered. ' ------------------------------------------------------------------------------ ShowHTA(CurrentDir & "step_7_predeploy.hta") Set strFolderwithCABFiles = objFSO.GetFolder(strORACLE_HOME _ & "\PUBLIC\enu\21219\APPLETS") Set arrCABFiles = strFolderwithCABFiles.Files strKeyPathDPF = "SOFTWARE\Microsoft\Windows\CurrentVersion" _ & "\Internet Settings\ActiveX Cache" strValueNameDPF = "0" objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPathDPF,strValueNameDPF,strValueDPF WriteToLog "Folder for Downloaded Program Files is: " & strValueDPF For Each objCABFile In arrCABFiles If LCase(Right(objCABFile.Name,4)) = ".cab" Then strCommand = "expand -f:*.* " & strORACLE_HOME & "\PUBLIC\enu\21219\APPLETS\" _ & objCABFile.Name & " " & Chr(34) & strValueDPF & Chr(34) WriteToLog "Action: - Executing: objShell.Run " & strCommand & ",0,True" objShell.Run StrCommand,0,True End If Next Set strFolderwithDPFiles = objFSO.GetFolder(strValueDPF) Set arrDPFiles = strFolderwithDPFiles.Files WriteToLog "Action: -> Registering or deleting the files in " & strValueDPF For Each objDPFile In arrDPFiles strDPFile = lcase(objDPFile.Name) If (Left(strDPFile,1)="s" AND Right(strDPFile,4)=".dll") OR _ (Left(strDPFile,1)="s" AND Right(strDPFile,4)=".ocx") OR _ (Left(strDPFile,4)="ieop" AND Right(strDPFile,4)=".dll") Then strCommand = "regsvr32 /s " & Chr(34) & strValueDPF & "\" & strDPFile & Chr(34) valResult = objShell.Run(strCommand,6,True) If valResult = 0 Then WriteToLog "Action: 'objShell.Run(" & strCommand & ",6,True)' succeeded." Else WriteToLog "Action: 'objShell.Run(" & strCommand & ",6,True)' failed." End If End If If (Left(strDPFile,1)="s" AND Right(strDPFile,4)=".exe") Then strCommand = Chr(34) & strValueDPF & "\" & strDPFile & Chr(34) & " /regserver" valResult = objShell.Run(strCommand,1,True) If valResult = 0 Then WriteToLog "Action: 'objShell.Run(" & strCommand & ",6,True)' succeeded." Else WriteToLog "Action: 'objShell.Run(" & strCommand & ",6,True)' failed." End If End If If Right(strDPFile,6)=".class" Then objFSO.DeleteFile strValueDPF & "\" & strDPFile WriteToLog "Action: The file '" & strValueDPF & Chr(92) & strDPFile _ & "' has been deleted." End If Next End Sub Sub PredeployOracleINFFiles ' ------------------------------------------------------------------------------ ' Sub PredeployOracleINFFiles ' Reads all the .inf files in C:\Windows\Downloaded Program Files. Finds the ' dll file in the inf file ' and then adds the registration in the registry. ' ------------------------------------------------------------------------------ strKeyPathDPF = "SOFTWARE\Microsoft\Windows\CurrentVersion" _ & "\Internet Settings\ActiveX Cache" strKeyPathModuleUsage = "SOFTWARE\Microsoft\Windows\CurrentVersion\ModuleUsage\" strValueNameDPF = "0" objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPathDPF,strValueNameDPF,strValueDPF WriteToLog "Folder for Downloaded Program Files is: " & strValueDPF Set strFolderwithINFFiles = objFSO.GetFolder(strValueDPF) Set arrINFFiles = strFolderwithINFFiles.Files WriteToLog "Action: -> Processing the INF files in " & strValueDPF For Each objINFFile In arrINFFiles strINFFile = LCase(objINFFile.Name) If Right(strINFFile,4) = ".inf" Then strINFFile = strValueDPF & "\" & strINFFile WriteToLog "Action: -> Processing INF File: " & strINFFile Set objINFFileToRead = objFSO.OpenTextFile(strINFFile, ForReading, False) Do While NOT objINFFileToRead.AtEndOfStream strLine = Trim(objINFFileToRead.ReadLine) strLine = lcase(strLine) If Left(strLine,1) = "[" AND Right(strLine,5)=".dll]" Then strDLLFileName = strLine ' Remove first '[' strDLLFileName = Right(strDLLFileName,Len(strDLLFileName)-1) ' Remove last ']' strDLLFileName = Left (strDLLFileName,Len(strDLLFileName)-1) WriteToLog "Action: -> Found dll file " & strDLLFileName & " in " _ & strINFFile & "." strDLLFileName = strValueDPF & Chr(92) & strDLLFileName End If If Left(strLine,5) = "clsid" Then arrCLSID = Split(strLine,"=") strCLSID = arrCLSID(1) WriteToLog "Action: -> Found CLSID " & strCLSID & " in " & strINFFile & "." End If strDLLFileName = replace(strDLLFileName, "\","/") objReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPathModuleUsage & strDLLFileName WriteToLog "Action: -> Created registry key: HKEY_LOCAL_MACHINE\" _ & strKeyPathModuleUsage & strDLLFileName objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPathModuleUsage _ & strDLLFileName , ".Owner" , strCLSID WriteToLog "Action: -> Created hive '.Owner' with value " & strCLSID _ & " in HKEY_LOCAL_MACHINE\" & strKeyPathModuleUsage & strDLLFileName objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPathModuleUsage _ & strDLLFileName , strCLSID , "" WriteToLog "Action: -> Created hive '" & strCLSID _ & "' with an empty value in HKEY_LOCAL_MACHINE\" _ & strKeyPathModuleUsage & strDLLFileName Loop End If Next End Sub |