Solved

Need help with Script

Posted on 2014-02-19
6
288 Views
Last Modified: 2014-03-05
Greeting Experts,

I am new to scripting and needs some help creating either a “VB script” or “Batch file” that can be used as a template. The purpose of the script is to make some changes to the routing table on a small number of computers (located on factory floors) that have no need for internet access.
What I am looking to do is create a simple script (i.e. template) that our Domain Admins can make changes on the routing table (i.e. route delete & route Add). Meaning the only thing they would need to change is the IP address of each route based sub-net/mask for each of the locations… I would appreciate any help with this problem…


Example of the routing table looking to use in the script template

Route Delete 0.0.0.0
Route add 10.40.XX.XX mask 255.255.255.0 10.25.XX.XX
Route add 170.146.XX.XX mask 255.255.255.0 10.25.XX.XX
Route add 97.107.XX.XX mask 255.255.255.0 10.25.XX.XX
Route add 10.20.XX.XX mask 255.255.255.0 10.25.XX.XX
0
Comment
Question by:amstoots
  • 3
  • 2
6 Comments
 
LVL 35

Expert Comment

by:Kimputer
ID: 39870629
A batch file is the easiest way and the most readable and understandable.
Actually what you just typed is actually almost working (except for the XX's)
Just copy and paste it in notepad and save as a .bat file.
0
 

Author Comment

by:amstoots
ID: 39870654
OK.. that all I need to do.......I should have put this in the original question but didn't ... I looking to do it in stealth mode.... I have done some reading and found you can do something to the effect of following below.. (code below) . Am I on the right track...

Echo off 

Route Delete 0.0.0.0
Route add 10.40.XX.XX mask 255.255.255.0 10.25.XX.XX
Route add 170.146.XX.XX mask 255.255.255.0 10.25.XX.XX
Route add 97.107.XX.XX mask 255.255.255.0 10.25.XX.XX
Route add 10.20.XX.XX mask 255.255.255.0 10.25.XX.XX 

Echo off 

Open in new window

0
 
LVL 35

Expert Comment

by:Kimputer
ID: 39870670
Yes you are on the right track (but still replace the XX). And the last echo off is also not necessary.
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
LVL 25

Accepted Solution

by:
Fred Marshall earned 500 total points
ID: 39870858
Here is a .bat file that should work.  Just change the variables to the addresses, masks that you want in each case: 1,2,3,4

NOTE: I added -p to make the routes persistent.  If you want them to disappear after a reboot then delete the -p entries.

This .bat file I believe requires that you run it under administrator privilieges.
One way to do that is to create a shortcut to the .bat file and then set the shortcut to run as administrator.

You have to change the file extension from .txt to .bat
route-add.txt
0
 

Author Comment

by:amstoots
ID: 39871440
Is there away to add a "Route Delete  XX.XX.XX.XX for the "-p" in the script in some way... I am just not sure how to work that.... ?
0
 

Author Closing Comment

by:amstoots
ID: 39907241
Thank you
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This script checks a path to see if a folder exists. If the folder does exist you will get output "The folder has previously been created. No action taken" If not it will create the folder. Then adds one user modify permission to the folder. It …
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now