fabmin
Goto Top

MultiPing VBScript mit EingabeModus

Dim inhalt(50)
Set MyShell = CreateObject("WScript.Shell")  
Set MyFiles = CreateObject("Scripting.FileSystemObject")  

If not MyFiles.FileExists("c:\Scripts\Logfile.txt") Then MyFiles.CreateTextFile("c:\Scripts\Logfile.txt")  
Abfrage = MsgBox ("Wollen Sie IP-Adressen hinzufügen?", vbYesNo)  
If Abfrage = vbYes Then
Do
Eingabe = InputBox("Geben Sie die neue(n) IP Adressen ein. Um den Ping Befehl auszuführen, klicken Sie auf abbrechen.")  
IPS=IPS & Eingabe & chr(13) & chr(10)
loop Until Eingabe = ""  
Set logfile = MyFiles.OpenTextFile("c:\Scripts\Logfile.txt",8)  
logfile.write(IPS)
logfile.close
End If

Set InfoZeile = MyFiles.OpenTextFile("c:\Scripts\Logfile.txt",1)  
Do
n=n+1
Inhalt(n) = InfoZeile.ReadLine
if Inhalt(n)="" then n=n-1  
Loop Until InfoZeile.AtEndOfStream = True

For x = 1 to n
Proggi = "%comspec% /c ping.exe -n 4 -a" & " " & Inhalt(x) & " " & ">c:\Scripts\temp.txt"  
Return = MyShell.Run(Proggi,0,True)
Set TempFile =MyFiles.OpenTextFile("c:\Scripts\temp.txt")  
Abfrage = Tempfile.Readall
If instr(Abfrage, "ytes=") > 0 Then  
Ausgabe = MsgBox("Ping an " + Inhalt(x) + " erfolgreich!", 1)  
Else
Ausgabe = MsgBox("Host " + Inhalt(x) + " nicht erreichbar", 1)  
End if
tempfile.close
If Ausgabe = 2 Then WScript.Quit
Next 

Content-Key: 16034

Url: https://administrator.de/contentid/16034

Printed on: April 25, 2024 at 01:04 o'clock