Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

increase TTL of a ping

Status
Not open for further replies.

evilkalah

Technical User
Jul 30, 2003
11
BE
i want to increase the TTL because he is to fast when i ping the pc in my cmd its working and when I'm doing it whith the script he is giving me back nr 30 what means (No response has been received within the timeout period.) is it possible? can you please give me some info? I also added in my file with hosts an ip of this network and even this one is giving me 30.

'read
Dim objFileSystem, objInputFile
Dim strInputFile, inputData, strData

Const OPEN_FILE_FOR_READING = 1

strOutputFile = "./" & Split(WScript.ScriptName, ".")(0) & ".in"

Set objFileSystem = CreateObject("Scripting.fileSystemObject")
Set objInputFile = objFileSystem.OpenTextFile(strOutputFile, OPEN_FILE_FOR_READING)

inputData = Split(objInputFile.ReadAll, vbNewline)
Set objIPNetwork = CreateObject("SScripting.IPNetwork")

'write
Dim objFileSystem2, objOutputFile2
Dim strOutputFile2

Const OPEN_FILE_FOR_APPENDING = 8


strOutputFile2 = "./" & Split(WScript.ScriptName, ".")(0) & ".out"

Set objFileSystem2 = CreateObject("Scripting.fileSystemObject")
Set objOutputFile2 = objFileSystem.OpenTextFile(strOutputFile2, OPEN_FILE_FOR_APPENDING)

objOutputFile2.WriteLine( "What do the numbers mean" )
objOutputFile2.WriteLine( "----------------------------------------" )
objOutputFile2.WriteLine( "0 True A valid ICMP Echo Response packet has been received. ")
objOutputFile2.WriteLine( "10 An ICMP Destination Unreachable packet has been received.")
objOutputFile2.WriteLine( "20 An ICMP Time Exceeded packet has been received, which may be caused by a TTL value being too small.")
objOutputFile2.WriteLine( "30 No response has been received within the timeout period.")
objOutputFile2.WriteLine( "100 One or more of the provided parameters contain an invalid value.")
objOutputFile2.WriteLine( "110 A WinSocket related error occurred.")
objOutputFile2.WriteLine( "120 The specified host address (hostname or IP-address) is invalid.")
objOutputFile2.WriteLine( "Else False")
objOutputFile2.WriteLine( "----------------------------------------" )
objOutputFile2.WriteLine( "Start of pinging " & date() & " " & time() )
objOutputFile2.WriteLine( "----------------------------------------" )

For each strData In inputData



intRetVal = objIPNetwork.Ping( strData )

'Select Case intRetVal
' Case 0 : Ping = "True" 'A valid ICMP Echo Response packet has been received. "
' Case 10 : Ping = "An ICMP Destination Unreachable packet has been received."
' Case 20 : Ping = "An ICMP Time Exceeded packet has been received, which may be caused by a TTL value being too small."
' Case 30 : Ping = "No response has been received within the timeout period."
' Case 100 : Ping = "One or more of the provided parameters contain an invalid value."
' Case 110 : Ping = "A WinSocket related error occurred."
' Case 120: Ping = "The specified host address (hostname or IP-address) is invalid."
' Case Else : Ping = "False"
'End Select



objOutputFile2.WriteLine( strData & " " & intRetVal & " " & date() & " " & time() )


Next
objOutputFile2.WriteLine( "----------------------------------------" )
objOutputFile2.WriteLine( "End of pinging" & date() & " " & time() )
objOutputFile2.WriteLine( "----------------------------------------" )
objOutputFile2.WriteLine( "" )
objOutputFile2.WriteLine( "" )
objOutputFile2.WriteLine( "" )
objOutputFile2.WriteLine( "" )

objOutputFile2.Close

Set objFileSystem2 = Nothing
Set objFileSystem = Nothing
WScript.Echo "All done"
WScript.Quit(0)
 
sorry addon when my host is in the file to read he is ginving me code 0 what is ok both other pcs he gives me 30 and when i ping them in cmd its working
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top