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.

112 lines
3.7 KiB
Plaintext

'Ruft alle Skripte in diesem Ordner auf, mit Ausnahme des Microsoft Patches
Option Explicit
Dim wshshell,fso,i,Fnct
Dim strPath,strSystemFolder,strWinFolder,strTempFolder
'----------------------------- Objekte erzeugen --------------------------------
Set wshshell = CreateObjectSafely("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set Fnct = CreateObjectSafely("Install.Functions")
'--------------------------- Standardpfade -------------------------------------
strPath = GetCurrentPath()
strSystemFolder = fso.GetSpecialFolder(1) & "\"
strWinFolder = fso.GetSpecialFolder(0) & "\"
strTempFolder = fso.GetSpecialFolder(2) & "\"
'------------------------------ Main -------------------------------------------
Call WriteToLog("Start")
Call wshshell.Run(strPath & "CreateFolders.vbs",1,TRUE)
Call wshshell.Run(strPath & "SystemDlls.vbs",1,TRUE)
Call wshshell.Run(strPath & "Register.vbs",1,TRUE)
Call wshshell.Run(strPath & "Patch.vbs",1,TRUE)
Dim strEnvironmentVbs
Dim strRunas
strEnvironmentVbs = strPath & "Environment.vbs"
Call wshshell.Run(strEnvironmentVbs,1,TRUE)
If UserFound("FockeAdmin") Then
strRunas = strPath & "FockeRunAs.exe FockeAdmin !Gemini " & """" & "wscript.exe " & strEnvironmentVbs & """"
Call wshshell.Run(strRunas,1,True)
End If
If UserFound("Autologon") Then
strRunas = strPath & "FockeRunAs.exe Autologon -Pluto " & """" & "wscript.exe " & strEnvironmentVbs & """"
Call wshshell.Run(strRunas,1,True)
End If
On Error resume Next
Call fso.DeleteFile("c:\windows\system32\restore\*.cab",true)
On Error Goto 0
Call wshshell.Run(strPath & "DesktopSettings.vbs",1,True)
Call wshshell.Run(strPath & "fw.vbs",1,TRUE)
Call wshshell.Run(strPath & "Privileges.vbs",1,TRUE)
Call wshshell.Run(strPath & "StartupFiles.vbs",1,TRUE)
Call wshshell.Run(strPath & "compact.bat",1,TRUE)
Call wshshell.Run(strPath & "ChangeComputerXml.vbs",1,TRUE)
Call 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
'Hilfsfunktion zum Erzeugen von Objekten
'Ist die Erzeugung nicht m<>glich, wird das Skript beendet
Function CreateObjectSafely(p_strObject)
Dim i
i = 0
On Error Resume Next
Do
err.Clear
i = i+1
Set CreateObjectSafely = CreateObject(p_strObject)
WScript.Sleep 1000
Loop Until Err.Number = 0 OR i > 30
If Err.Number <> 0 Then
MsgBox "Unable to Create Object: " & p_strObject
WScript.Quit
End If
On Error Goto 0
End Function
Function UserFound(strUserName)
Dim strDocsAndSets
strDocsAndSets = "C:\Documents and Settings\"
UserFound = fso.FolderExists(strDocsAndSets & strUserName)
End Function
'------------------------------ 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")
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