1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
Sub Parse_Txt_File(sTextFile)
Set objFso = CreateObject("Scripting.FileSystemObject")
Set F1 = objFso.OpenTextFile (sTextFile, 1)
Do Until F1.AtEndOfStream
Read = F1.ReadLine
MyArrayComa = Split(Read, ", ")
hostname = MyArrayComa(0)
appcompinstserver = MyArrayComa(1)
MyArrayMinus = Split(appcompinstserver, " - ")
For j = 0 to UBound(MyArrayMinus)
If Ubound(MyArrayMinus) = 0 Then
appcompinst = MyArrayMinus(0)
MyArrayPipe = Split(appcompinst, " | ")
If UBound(MyArrayPipe) < 2 Then
service = MyArrayPipe(1)
WScript.Echo hostname & ", " & service
Log_Msg strCmdbTxtPath, strCmdbTxt, lcase(hostname) & ", " & lcase(service)
Else
service = MyArrayPipe(1) & MyArrayPipe(2)
WScript.Echo hostname & ", " & service
Log_Msg strCmdbTxtPath, strCmdbTxt, lcase(hostname) & ", " & lcase(service)
End If
Else
appcompinst = MyArrayMinus(j)
MyArrayPipe = Split(appcompinst, " | ")
If UBound(MyArrayPipe) < 2 Then
service = MyArrayPipe(1)
WScript.Echo hostname & ", " & service
Log_Msg strCmdbTxtPath, strCmdbTxt, lcase(hostname) & ", " & lcase(service)
Else
service = MyArrayPipe(1) & MyArrayPipe(2)
WScript.Echo hostname & ", " & service
Log_Msg strCmdbTxtPath, strCmdbTxt, lcase(hostname) & ", " & lcase(service)
End If
End If
Next
Loop
End Sub |
Partager