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.

113 lines
3.3 KiB
Plaintext

'-------------------------------------------------------------------------------
' (C) Focke & Co
' Date:
' 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 -------------------------------------------
Call InstallMsiFile(strPath & "FCI\FCI.msi",strTempFolder & "FCI.log")
Dim strProgramFiles
strProgramFiles = ExpandPath("%ProgramFiles%","c:\Program Files")
Dim strFockeTools
strFockeTools = ExpandPath("%FOCKETOOLSDIR%","C:\FockeTools") & "\"
If fso.FileExists(strFockeTools & "\fwprgadd.bat") Then
Call wshshell.Run(strFockeTools & "\fwprgadd.bat " & """" & strProgramFiles & "\Focke\FCI\FCIServer.exe"" ""FCI Server""",1,True)
Call wshshell.Run(strFockeTools & "\fwportadd.bat " & "TCP 2004 FCI",1,True)
End If
'------------------------------- 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