'------------------------------------------------------------------------------- ' (C) Focke & Co ' Date: 27.1.09 ' 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") strCurrentObject = "Scripting.FileSystemObject" Set fso = CreateObject("Scripting.FileSystemObject") strCurrentObject = "Install.Functions" Set Fnct = CreateObject("Install.Functions") 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 ------------------------------------------- Dim strMainVolume, strSoftwareTxt strMainVolume = ExpandPath("%MAIN_VOLUME%","c:\") strSoftwareTxt = strMainVolume & "Software.txt" Dim SoftwareTxt Dim strFileContent Dim bHasFBR Set SoftwareTxt = fso.OpenTextFile(strSoftwareTxt,1,false) strFileContent = UCASE(SoftwareTxt.ReadAll) SoftwareTxt.Close bHasFBR = Instr(strFileContent,"FOCKEBACKUPREPLICATOR") > 0 If Not bHasFBR Then wscript.quit On Error Resume Next Dim Progress Set Progress = CreateObject("Progress.InstProgress") Progress.Title = "FockeBackupReplicator" On Error Goto 0 Dim strInstallDataPath strInstallDataPath = strPath & "FockeBackupReplicator\" Progress.Status = "FockeBackupReplicator" Dim strFbrLog strFbrLog = strTempFolder & "FockeBackupReplicatorInstall.log" ' Wenn man es nur einmal aufruft fehlen u.U. Dateien Call InstallMsiFile("""" & strInstallDataPath & "FockeBackupReplicator.msi""", strFbrLog) Call InstallMsiFile("""" & strInstallDataPath & "FockeBackupReplicator.msi""", strFbrLog) wscript.Sleep(10000) const strTargetPath = "c:\Program Files\Focke\FockeBackupReplicator" const strPatchFolder = "c:\Servicepacks\FBR\FbrPatch" Call fso.CopyFolder(strPatchFolder,strTargetPath,True) call wshshell.Run("""" & strTargetPath & "\ChangeFBRAutorunLink.vbs""") '------------------------------- 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 MACHINE=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