Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Tracert script

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,52572
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Tracert script
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Tracert script - 10/10/2007 12:43:00 AM   
  ddhoman

 

Posts: 5
Score: 0
Joined: 10/10/2007
Status: offline
I am new to vbscript but would like a vbscript to do a tracert from a Windows box.
I am needing to verify that traffic from our Branch servers is going down the correct network path.
Meaning:
If I do a traceroute from the server to a 172.20.59 network, it should be heading down a 172.27 network path. This designates the MPLS network
If it does a traceroute from the server to a 172.20.60 network it should be heading down a 172.20.231 network. This designates VPN tunnel traffic.
Our network engineers sometimes getting routing messed up and forget to convert it back to the way we would like...this would be a notification that traffic is headning down the wrong path.

C:\ITOHTTPS>tracert qwapp
Tracing route to qwapp.crown.com [172.20.59.219]
over a maximum of 30 hops:
1    <1 ms    <1 ms    <1 ms  172.20.116.1
2    10 ms    10 ms    10 ms  172.27.116.153
3    64 ms    64 ms    67 ms  172.27.108.153
4    94 ms    94 ms    94 ms  172.27.108.154
5    87 ms   244 ms    86 ms  172.20.240.10
6   114 ms   124 ms   110 ms  corp219.us.crownlift.net [172.20.59.219]
The above is an example of it heading correctly down the MPLS network.
but sometimes they make changes for whatever reason, and it will be the following for weeks...causing high utilization


C:\ITOHTTPS>tracert qwapp----THIS ONE IS INCORRECT....
Tracing route to qwapp.crown.com [172.20.59.219]
over a maximum of 30 hops:
1    <1 ms    <1 ms    <1 ms  172.20.116.1
2    10 ms    10 ms    10 ms  172.20.231.153
3    64 ms    64 ms    67 ms  172.20.231.153
4    94 ms    94 ms    94 ms  172.20.231.154
5    87 ms   244 ms    86 ms  172.20.240.10
6   114 ms   124 ms   110 ms  corp219.us.crownlift.net [172.20.59.219]

How do I parse the traceroute to get the ip range?
Can someone help me here...


 
 
Post #: 1
 
 RE: Tracert script - 10/10/2007 12:59:00 AM   
  ebgreen


Posts: 5250
Score: 31
Joined: 7/12/2005
Status: offline
You are going to use the .Run method of the WScript.Shell object or the Execute command to run the Tracert command and capture the output. Then you will iterate through each line of the output and use the Split() function to break it into pieces. The last piece is the ip address for that hop.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to ddhoman)
 
 
Post #: 2
 
 RE: Tracert script - 10/10/2007 1:11:16 AM   
  ddhoman

 

Posts: 5
Score: 0
Joined: 10/10/2007
Status: offline
Thank you so much for the reply, I really am just needing the answer of what is on Line 2...if line 2 is heading down the wrong path, I need an alert...can you help get me started?

(in reply to ebgreen)
 
 
Post #: 3
 
 RE: Tracert script - 10/10/2007 1:13:10 AM   
  ebgreen


Posts: 5250
Score: 31
Joined: 7/12/2005
Status: offline
Sure, to get started read the "Read Me First" post. Then read the "Frequently Asked Stuff" post. Then search for the things that I mentioned to find examples of their use. Then write some code. Post back here if the code you write does not work.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to ddhoman)
 
 
Post #: 4
 
 RE: Tracert script - 10/10/2007 1:27:20 AM   
  ddhoman

 

Posts: 5
Score: 0
Joined: 10/10/2007
Status: offline
I am blind, where is the FAQ post?
I couldn't find it...I had read the Read Me First Post...

(in reply to ebgreen)
 
 
Post #: 5
 
 RE: Tracert script - 10/10/2007 1:32:57 AM   
  ebgreen


Posts: 5250
Score: 31
Joined: 7/12/2005
Status: offline
The frequently asked stuff post is right above the read me first post.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to ddhoman)
 
 
Post #: 6
 
 RE: Tracert script - 10/10/2007 2:02:11 AM   
  ddhoman

 

Posts: 5
Score: 0
Joined: 10/10/2007
Status: offline
Sorry to be a pain, am I traveling around incorrectly.
I went into Forums
I went int New Member Intro
I went back to Forums
and then clicked on WSH & Clinet Side VBscript...
I am not seeing the FAQ or the terminology you are talking about, I also have it set to tree view, but that shouldn't matter.

(in reply to ebgreen)
 
 
Post #: 7
 
 RE: Tracert script - 10/10/2007 2:09:08 AM   
  dm_4ever


Posts: 2726
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
Look at my signature.

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to ddhoman)
 
 
Post #: 8
 
 RE: Tracert script - 10/10/2007 2:55:31 AM   
  ddhoman

 

Posts: 5
Score: 0
Joined: 10/10/2007
Status: offline
Thank you for the reply...love your site...
I have a script I am trying to do with the above task I mentioned...


Dim arrTxtFile : arrTxtFile = ReadTxtToArray("c:\temp\trace.txt")
Function ReadTxtToArray(strInputFilePath)
Const ForReading = 1
' create FSO
Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject")
' open text file for reading
Dim objFile : Set objFile = objFSO.OpenTextFile(strInputFilePath, ForReading)
' read the content of the file and split into an array using vbCrLf as the seperator
' and return the array
ReadTxtToArray = Split(objFile.ReadAll, VbCrLf)
' close the file
objFile.Close
End Function
and it gives me a Line 1 Character 1 Invalid Character....
I am just trying to get the text file setup to read and parse...
already flunking, what it wrong?

(in reply to dm_4ever)
 
 
Post #: 9
 
 RE: Tracert script - 10/10/2007 3:43:03 AM   
  dm_4ever


Posts: 2726
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
That alone does not generate an error for me. If you are just going to loop through a file I would do it the old fashion way though.


      

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to ddhoman)
 
 
Post #: 10
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Tracert script Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts