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
|
Set Fichier_Parcourir2 = objFSO.OpenTextFile("dump.txt", ForReading)
Set Fichier_Resultat2 = objFSO.CreateTextFile(path_creer2, ForWriting, ModeAscii)
dhcp_server1 = "10.0.0.1"
Do While Fichier_Parcourir2.AtEndOfStream <> True
Contenu_All2 = Fichier_Parcourir2.ReadAll
Tableau1 = Split(Contenu_All2, vbNewLine)'Eclate le contenu ligne par ligne du fichier 2 en faisant un tableau
For L = 0 To UBound(Tableau1)
Ligne1 = (Tableau1(L))
Select Case True
'Exemple : Dhcp Server 10.0.0.1 add scope 10.0.2.0 255.255.255.0 "Nom Mon Scope" "Desc Mon scope"
Case instr(Ligne1,("Dhcp Server " & dhcp_server1 & " add scope ")) > 0
sTableau1 = split(Ligne1," ")
sTableau2 = split(Ligne1,"""")
SCOPE = sTableau1(5)
MASK_SCOPE = sTableau1(6)
NOM_SCOPE = sTableau2(1)
DESC_SCOPE = sTableau2(3)
'Exemple : Dhcp Server 10.0.0.1 Scope 10.0.2.0 set state 1
Case instr(Ligne1,("Dhcp Server " & dhcp_server1 & " Scope " & SCOPE & " set state")) > 0
sTableau1 = split(Ligne1," ")
ETAT_SCOPE = sTableau1(7)
'Exemple : Dhcp Server 10.0.0.1 Scope 10.0.2.0 set optionvalue 51 DWORD "691200"
Case instr(Ligne1,("Dhcp Server " & dhcp_server1 & " Scope " & SCOPE & " set optionvalue 51 DWORD """)) > 0
sTableau1 = split(Ligne1," ")
LEASE_SCOPE = replace(sTableau1(9),"""","")
Fichier_Resultat2.writeline SCOPE & vbtab & MASK_SCOPE & vbtab & NOM_SCOPE & vbtab & DESC_SCOPE & vbtab & ETAT_SCOPE & vbtab & LEASE_SCOPE
End Select
Loop |
Partager