General discussion
Thread display: Collapse - |
All Comments
Start or search
Create a new discussion
If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.
Automation Tools
Earlier this morning I downloaded the ping automation tool.
Though it could be very useful tool, it does not tell you anything other than if a IP address on a given network is being used.
With that in mind, I decided it would be more useful if the tool resolved IP to name, using tracert.exe. After making minor adjustments to the script, it now resolves IP to name within a given network over a maximum of one hop.
Below is a copy of the script edited
Thanks
M.Ahmed
Please copy everything between the "***" lines to a text file then save the file as "Auto Tracert.vbs"
**************************************************
'This script was writen to launches a ping test and sends keys to automate the process,
'Edited by Munir Ahmed to Tracert then write the output to a file.
Dim FirstPrompt, ErrorMessage, FileSystem, NetworkNum, FirstNodeNum, LastNodeNum, Dummy
Dim DotTest, TheDate, TheTime, TheFile, NodeNum
FirstPrompt = "Please enter the first three octets of the IP addresses you want to test." & vbCrLf & vbCrLf &_
"Use the form 123.456.789." & vbCrLf & vbCrLf &_
"Be sure to include the . after the last number."
ErrorMessage = "Operation failed!" & vbCrLf & vbCrLf &_
"You didn't include the . after the last number." & vbCrLf & vbCrLf &_
"Please repeat the operation."
TheDate = Date
TheTime = Time
Const ForWriting = 2, ForAppending = 8
Set WshShell = WScript.CreateObject("WScript.Shell")
Set FileSystem = CreateObject("Scripting.FileSystemObject")
NetworkNum = InputBox(FirstPrompt,"tracert Automation Tool")
If NetworkNum = "" Then Wscript.Quit
DotTest = Right(NetworkNum,1)
If DotTest <> "." Then
Dummy = WshShell.Popup(ErrorMessage,0, "tracert Automation Tool",16)
Wscript.Quit
Else
FirstNodeNum = InputBox("Enter the first node number in the test range:","tracert Automation Tool")
If FirstNodeNum = "" Then Wscript.Quit
LastNodeNum = InputBox("Enter the last node number in the test range:","tracert Automation Tool")
If LastNodeNum = "" Then Wscript.Quit
End If
Dummy = WshShell.Popup ( "Building tracert File. Please Wait...",1,"tracert Automation Tool",64)
If (FileSystem.FileExists("c:\tracertfile.txt")) Then
Set TheFile = FileSystem.OpenTextFile("c:\tracertfile.txt", ForAppending, True)
Else
Set TheFile = FileSystem.OpenTextFile("c:\tracertfile.txt", ForWriting, True)
End If
TheFile.WriteBlankLines(1)
TheFile.WriteLine("=========================================")
TheFile.WriteLine(" tracert Automation Tool")
TheFile.WriteLine("This tracert Session was run on: " & TheDate & " at " & TheTime)
TheFile.WriteLine("Testing " & NetworkNum&FirstNodeNum & " thru " & NetworkNum&LastNodeNum)
TheFile.WriteLine("=========================================")
TheFile.WriteBlankLines(1)
TheFile.Close
For NodeNum = FirstNodeNum To LastNodeNum
WshShell.Run "Cmd.exe /c tracert.exe -h 1 " &NetworkNum&NodeNum &" >> c:\tracertfile.txt", 2,True
WshShell.Run "Cmd.exe /c Echo. >> c:\tracertfile.txt", 2,True
WshShell.Run "Cmd.exe /c Echo ********************************** >> c:\tracertfile.txt", 2,True
Next
WshShell.Run "Notepad.exe c:\tracertfile.txt", 1,True
Wscript.Quit
**************************************************