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.
133 lines
4.0 KiB
Plaintext
133 lines
4.0 KiB
Plaintext
'-------------------------------------------------------------------------------
|
|
' (C) Focke & Co
|
|
' Date:
|
|
' Author: cbr
|
|
' Startet zunächst die Zuordnung der Laufwerksbuchstaben und dann den FBR
|
|
'-------------------------------------------------------------------------------
|
|
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 strFockeTools,strMainVolume,strComputerIni,strComputerXml
|
|
|
|
strFockeTools = ExpandPath("%FOCKETOOLSDIR%","C:\FockeTools") & "\"
|
|
strMainVolume = ExpandPath("%MAIN_VOLUME%","c:\")
|
|
strComputerIni = strMainVolume & "Computer.ini"
|
|
strComputerXml = strMainVolume & "Computer.xml"
|
|
|
|
'------------------------------ Main -------------------------------------------
|
|
wscript.Sleep 120000
|
|
If Not fso.FolderExists("c:\temp\Visu2000") Then
|
|
wscript.quit
|
|
End If
|
|
Call wshshell.Run(strFockeTools & "IsAdmin.exe",1,True)
|
|
If Fnct.GetIniString("CurrentLogon","Administrator",strComputerIni) = "1" Then
|
|
Call wshshell.run("""" & strPath & "AssignDriveLetters.vbs""", 1,True)
|
|
Else
|
|
If fso.FileExists("c:\temp\fbrReady.txt") then fso.DeleteFile("c:\temp\fbrReady.txt")
|
|
Dim strExec
|
|
strExec = strFockeTools & "FockeRunas.exe FockeAdmin !Gemini " & """" & strPath & "AssignDriveLetters.bat"""
|
|
'strExec = """" & strPath & "FockeBackupReplicator.exe"""
|
|
'MsgBox strExec
|
|
Call wshshell.run(strExec, 1,True)
|
|
Do
|
|
wscript.Sleep 1000
|
|
Loop Until fso.FileExists("c:\temp\fbrReady.txt")
|
|
End If
|
|
Call wshshell.run("""" & strPath & "FockeBackupReplicator.exe""")
|
|
|
|
|
|
|
|
|
|
'------------------------------- 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
|