|
|
|
|
'-------------------------------------------------------------------------------
|
|
|
|
|
' (C) Focke & Co
|
|
|
|
|
' Date:
|
|
|
|
|
' Author: cbr
|
|
|
|
|
' Patch: <20>ndert den Link zum Start des FBRs
|
|
|
|
|
'-------------------------------------------------------------------------------
|
|
|
|
|
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) & "\"
|
|
|
|
|
|
|
|
|
|
Dim strStartupFolder
|
|
|
|
|
strStartupFolder = wshshell.SpecialFolders(3) & "\"
|
|
|
|
|
'------------------------------ Main -------------------------------------------
|
|
|
|
|
If fso.FileExists(strStartupFolder & "FockeBackupReplicator.lnk") Then
|
|
|
|
|
fso.DeleteFile(strStartupFolder & "FockeBackupReplicator.lnk")
|
|
|
|
|
End If
|
|
|
|
|
Dim FbrShortcut
|
|
|
|
|
Set FbrShortcut = wshshell.CreateShortcut(strStartupFolder & "FockeBackupReplicator.lnk")
|
|
|
|
|
FbrShortcut.TargetPath = "c:\Program Files\Focke\FockeBackupReplicator\Startup.vbs"
|
|
|
|
|
FbrShortcut.Save
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'------------------------------- 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
|