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.
175 lines
5.1 KiB
Plaintext
175 lines
5.1 KiB
Plaintext
2 years ago
|
'Patch 2010/03
|
||
|
Option Explicit
|
||
|
Dim wshshell,fso,i,Fnct
|
||
|
Dim strPath,strSystemFolder,strWinFolder,strTempFolder
|
||
|
'----------------------------- Objekte erzeugen --------------------------------
|
||
|
i = 0
|
||
|
On Error Resume Next
|
||
|
Do
|
||
|
err.Clear
|
||
|
i = i+1
|
||
|
Set wshshell = CreateObject("WScript.Shell")
|
||
|
Set fso = CreateObject("Scripting.FileSystemObject")
|
||
|
Set Fnct = CreateObject("Install.Functions")
|
||
|
WScript.Sleep 1000
|
||
|
Loop Until Err.Number = 0 OR i > 30
|
||
|
|
||
|
If Err.Number <> 0 Then
|
||
|
WScript.Quit
|
||
|
End If
|
||
|
|
||
|
On Error Goto 0
|
||
|
|
||
|
'--------------------------- Standardpfade -------------------------------------
|
||
|
strPath = GetCurrentPath()
|
||
|
strSystemFolder = fso.GetSpecialFolder(1) & "\"
|
||
|
strWinFolder = fso.GetSpecialFolder(0) & "\"
|
||
|
strTempFolder = fso.GetSpecialFolder(2) & "\"
|
||
|
|
||
|
|
||
|
'------------------------------ Main -------------------------------------------
|
||
|
WriteToLog("Start")
|
||
|
|
||
|
Dim strSoftwareTxt, strSoftwareTxtContent
|
||
|
Dim strMainVolume
|
||
|
|
||
|
strMainVolume = ExpandPath("%MAIN_VOLUME%","c:\")
|
||
|
strSoftwareTxt = strMainVolume & "Software.txt"
|
||
|
strSoftwareTxtContent = ReadFileContent(strSoftwareTxt)
|
||
|
|
||
|
'Retten der alten TCATSysSrv.exe
|
||
|
Dim strFileToRescue
|
||
|
Dim strRescuedFile
|
||
|
strFileToRescue = "c:\TWinCAT\TCATSysSrv.exe"
|
||
|
strRescuedFile = fso.BuildPath(strTempFolder,"TCATSysSrv.exe")
|
||
|
If fso.FileExists(strFileToRescue) Then
|
||
|
Call fso.CopyFile(strFileToRescue,strRescuedFile)
|
||
|
End if
|
||
|
'Installation
|
||
|
Dim strMsiFile,strLogFile
|
||
|
|
||
|
|
||
|
If Instr(1,strSoftwareTxtContent,"FockeBackupReplicator") <> 0 Then
|
||
|
strMsiFile = """" & strPath & "FockeBackupReplicator.msi"""
|
||
|
strLogFile = """" & strTempFolder & "FockeBackupReplicator.log"""
|
||
|
Call InstallMsiFile(strMsiFile,strLogFile)
|
||
|
End If
|
||
|
|
||
|
|
||
|
strMsiFile = """" & strPath & "FockeSP_SysfilesXP.msi"""
|
||
|
strLogFile = """" & strTempFolder & "SysfilesXP.log"""
|
||
|
Call InstallMsiFile(strMsiFile,strLogFile)
|
||
|
|
||
|
strMsiFile = """" & strPath & "SecondaryLogon.msi"""
|
||
|
strLogFile = """" & strTempFolder & "SecondaryLogon.log"""
|
||
|
Call InstallMsiFile(strMsiFile,strLogFile)
|
||
|
|
||
|
strMsiFile = """" & strPath & "MbDiag\Setup.msi"""
|
||
|
strLogFile = """" & strTempFolder & "InstallMbDiag.log"""
|
||
|
Call InstallMsiFile(strMsiFile,strLogFile)
|
||
|
|
||
|
strMsiFile = """" & strPath & "FockeTools.msi"""
|
||
|
strLogFile = """" & strTempFolder & "FockeTools.log"""
|
||
|
Call InstallMsiFile(strMsiFile,strLogFile)
|
||
|
|
||
|
On Error Resume Next
|
||
|
Dim strPcType
|
||
|
strPcType = ""
|
||
|
const PcTypeKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Beckhoff\IPC\Platform"
|
||
|
strPcType = wshshell.RegRead(PcTypeKey)
|
||
|
Err.Clear
|
||
|
On Error Goto 0
|
||
|
If Instr(strPcType,"C6930") <> 0 Then
|
||
|
strMsiFile = """" & strPath & "MbDiag\C6930\Setup.msi"""
|
||
|
strLogFile = """" & strTempFolder & "InstallMbDiag.log"""
|
||
|
Call InstallMsiFile(strMsiFile,strLogFile)
|
||
|
End If
|
||
|
|
||
|
'Wenn der TCATSysSrv.exe verschwinden ist, dann wiederherstellen
|
||
|
If Not fso.FileExists(strFileToRescue) Then
|
||
|
Call fso.CopyFile(strRescuedFile,strFileToRescue)
|
||
|
End If
|
||
|
'Spuren verwischen
|
||
|
If fso.FileExists(strRescuedFile) Then
|
||
|
Call fso.DeleteFile(strRescuedFile,True)
|
||
|
End If
|
||
|
|
||
|
WriteToLog("End")
|
||
|
|
||
|
'------------------------------- 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
|
||
|
|
||
|
Function ReadFileContent(p_strFileName)
|
||
|
Const ForReading = 1, ForWriting = 2, ForAppending = 8
|
||
|
Dim TextFile
|
||
|
Set TextFile = fso.OpenTextFile(p_strFileName,ForReading)
|
||
|
ReadFileContent = TextFile.ReadAll()
|
||
|
TextFile.Close
|
||
|
End Function
|
||
|
'----------------------------------- Sub --------------------------------------
|
||
|
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 /l* " & p_strLogFile & " /i " & p_strMsiFile & " REBOOT=ReallySuppress")
|
||
|
i = 0
|
||
|
do
|
||
|
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
|
||
|
err.Clear
|
||
|
On Error Goto 0
|
||
|
End If
|
||
|
err.Clear
|
||
|
i = i+1
|
||
|
loop until (bResult = True) Or (i >60)
|
||
|
End Sub
|
||
|
|
||
|
Sub WriteToLog(p_strMessage)
|
||
|
Const ForReading = 1, ForWriting = 2, ForAppending = 8
|
||
|
Dim strLineToWrite
|
||
|
strLineToWrite = WScript.ScriptName & " -- " & p_strMessage
|
||
|
Dim strLogFile
|
||
|
strLogFile = ExpandPath("%SERVICEPACK_LOG%","c:\fockeservicepack.log")
|
||
|
' msgbox sLine & LogFile
|
||
|
Dim FileObject
|
||
|
if fso.FileExists(strLogFile) then
|
||
|
set FileObject = fso.OpenTextFile( strLogFile,ForAppending,false,0)
|
||
|
else
|
||
|
set FileObject = fso.OpenTextFile( strLogFile,ForWriting, true,0)
|
||
|
end if
|
||
|
FileObject.WriteLine(strLineToWrite)
|
||
|
FileObject.Close
|
||
|
set FileObject=nothing
|
||
|
End Sub
|
||
|
|