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.2 KiB
Plaintext
112 lines
3.2 KiB
Plaintext
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 strFockeTools
|
|
strFockeTools = ExpandPath("%FOCKETOOLSDIR%","C:\FockeTools") & "\"
|
|
|
|
Dim strMaindir
|
|
Dim strComputerIni
|
|
strMaindir = ExpandPath("%Maindir%","c:\")
|
|
strComputerIni = strMaindir & "Computer.ini"
|
|
|
|
If Fnct.GetIniString("CD1_Setup","Firewall",strComputerIni) = "1" Then
|
|
Call PortAdd("137","netbios-ns","ALL","ALL")
|
|
Call PortAdd("139","netbios","TCP","ALL")
|
|
Call PortAdd("123","NTP","UDP","SUBNET")
|
|
End If
|
|
|
|
Call wshshell.Run(GetCurrentPath() & "\dcs_dcom.vbs",1,TRUE)
|
|
|
|
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
|
|
|
|
'----------------------------------- 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
|
|
|
|
Sub PortAdd(p_strPort,p_strName,p_strProtocol,p_strScope)
|
|
i = 0
|
|
Dim Success
|
|
Success = False
|
|
Do
|
|
Dim ResultFile
|
|
Dim strResultFileName
|
|
Dim strResultFileContent
|
|
i = i+5
|
|
Call wshshell.Run(strFockeTools & "\fwportadd.bat "& p_strProtocol & " " & p_strPort & " """ & p_strName & """ " & p_strScope & " > %temp%\fwtest.txt",1,True)
|
|
strResultFileName = ExpandPath("%temp%\fwtest.txt","c:\Temp\fwtest.txt")
|
|
Set Resultfile = fso.OpenTextFile(strResultFileName)
|
|
strResultFileContent = ResultFile.ReadAll()
|
|
If(Instr(strResultFileContent,"The service has not been started.") = 0) Then
|
|
Success = True
|
|
Else
|
|
WScript.Sleep 5000
|
|
End If
|
|
Loop Until Success Or i > 120
|
|
End Sub
|
|
|
|
|
|
|