We help IT Professionals succeed at work.
Get Started

Need some help writing a script

83 Views
Last Modified: 2015-08-24
Need some help writing a script.....trying to have the script query the computer name and then run a command based on what is the resulting computer name.

For instance, these are the computer names:
DESKTOP
LAPTOP
LAPTOP-BACKUP

If the result is DESKTOP run
route add 192.168.1.0 mask 255.255.255.0 192.168.1.1 IF 37
Then quit

If the result is LAPTOP run
route add 192.168.1.0 mask 255.255.255.0 192.168.1.1 IF 24
Then quit

etc with LAPTOP-BACKUP, the IF # will probably be different

This is to help script VPN connections, so there will be different files based on different networks.

I have to delete the route later, but that command is easier
route delete 192.168.1.0
So that is not computer dependent.

The super bestest thing in the entire world would be if the computer name, and IF (interface) number were tied together. The network address and mask should never change. That way if I change computers or IF changes, I make one change opposed to a bunch of files.
Comment
Watch Question
End-user support
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 3 Answers and 8 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE