You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

142 lines
4.0 KiB
Plaintext

'-------------------------------------------------------------------------------
' (C) Focke & Co
' Date: 22.09.2010
' Author: cbr
'-------------------------------------------------------------------------------
Option Explicit
Dim wshshell,fso,i,Fnct
Dim strPath,strSystemFolder,strWinFolder,strTempFolder
'----------------------------- Objekte erzeugen --------------------------------
Dim strCurrentObject
i = 0
On Error Resume Next
Do
err.Clear
i = i+1
strCurrentObject = "WScript.Shell"
Set wshshell = CreateObject("WScript.Shell")
If Err.Number = 0 Then
strCurrentObject = "Scripting.FileSystemObject"
Set fso = CreateObject("Scripting.FileSystemObject")
End If
If Err.Number = 0 Then
strCurrentObject = "Install.Functions"
Set Fnct = CreateObject("Install.Functions")
End If
WScript.Sleep 1000
Loop Until Err.Number = 0 OR i > 30
If Err.Number <> 0 Then
MsgBox "Unable to Create Object: " & strCurrentObject
WScript.Quit
End If
On Error Goto 0
'--------------------------- Standardpfade -------------------------------------
strPath = GetCurrentPath()
strSystemFolder = fso.GetSpecialFolder(1) & "\"
strWinFolder = fso.GetSpecialFolder(0) & "\"
strTempFolder = fso.GetSpecialFolder(2) & "\"
'------------------------------ Main -------------------------------------------
Call InstallPatch(strPath & "SystemDlls\WindowsXP-KB967715-x86-ENU.exe", strTempFolder & "WindowsXP-KB967715-x86-ENU.log")
Call InstallPatch(strPath & "SystemDlls\WindowsXP-KB2286198-x86-ENU.exe", strTempFolder & "WindowsXP-KB2286198-x86-ENU.log")
Call wshshell.Run(strPath & "TCI8254Patch_V211_390\TCI8254Patch_V211_390.vbs",1,True)
'------------------------------- Funktionen ------------------------------------
Function GetCurrentPath()
Dim l_strScriptName
Dim l_strTemp
l_strScriptName = WScript.ScriptFullName
l_strTemp = WScript.ScriptName
GetCurrentPath = Left(l_strScriptName, Len(l_strScriptName) - Len(l_strTemp))
End Function
Function ExpandPath(p_strEnvironment,p_strDefault)
Dim l_strTemp
l_strTemp = wshshell.ExpandEnvironmentStrings(p_strEnvironment)
If l_strTemp = p_strEnvironment Then
l_strTemp = p_strDefault
End If
ExpandPath = l_strTemp
End Function
'------------------------------ Sub -------------------------------------------
'Installiert eine MSI-datei im Silent Modus und verhindert einen Neustart
Sub InstallMsiFile(p_strMsiFile,p_strLogFile)
Dim i
Dim strFileContent
Dim bResult
Dim LogFile
Dim l_strLogFile
l_strLogFile = Replace(p_strLogFile,"""","")
wshshell.Run("msiexec.exe /qn DISABLEADVTSHORTCUTS=1 /l* " & p_strLogFile & " /i " & p_strMsiFile & " REBOOT=ReallySuppress")
i = 0
do
bResult = False
WScript.Sleep 1000
strFileContent = ""
If fso.FileExists(l_strLogFile) Then
On Error Resume Next
Set LogFile = fso.OpenTextFile(l_strLogFile,1,false,-1)
if(err.Number = 0) Then
strFileContent = LogFile.ReadAll
LogFile.Close
Else
strFileContent = ""
End If
bResult = Instr(strFileContent,"=== Logging stopped:") > 0
If Not bResult Then
bResult = Instr(strFileContent,"=== Protokollierung beendet:") > 0
End If
err.Clear
On Error Goto 0
End If
err.Clear
i = i+1
loop until (bResult = True) Or (i >300)
End Sub
'Installiert eine MSI-datei im Silent Modus und verhindert einen Neustart
Sub InstallPatch(p_strPatchFile,p_strLogFile)
Dim i
Dim strFileContent
Dim bResult
Dim LogFile
Dim l_strLogFile
l_strLogFile = Replace(p_strLogFile,"""","")
wshshell.Run("""" & p_strPatchFile & """ " & "/quiet /passive /norestart /nobackup /log:" & p_strLogFile)
i = 0
do
bResult = False
WScript.Sleep 1000
strFileContent = ""
If fso.FileExists(l_strLogFile) Then
On Error Resume Next
Set LogFile = fso.OpenTextFile(l_strLogFile,1,false,0)
if(err.Number = 0) Then
strFileContent = LogFile.ReadAll
LogFile.Close
Else
strFileContent = ""
End If
bResult = Instr(strFileContent,"RebootNecessary") > 0
err.Clear
On Error Goto 0
End If
err.Clear
i = i+1
loop until (bResult = True) Or (i >300)
End Sub