Copy a persistant route table between two servers

Hi Guys,

We are currently moving to a new monitoring system - and seeing as we have environments all over the world to monitor, we use many servers for this task - unfortunately, the servers that are running the current system can't work with the new one becuase of many reasons but there's one piece of very valuable information on each of them that copying by hand would take ages!

Many of the enviroments we monitor are connected via IPSEC tunnels and as such we need to instruct the server to send the ICMP / SNMP packets through the correct gateway to reach it's destination.

The question is, assuming I have two servers with the following configuration:
Server A (Source): Windows Server 2003 R2
Server B: (Destination): Windows Server 2008 (NOT R2)

can I somehow copy all the persistant routes from the source server to the destination server in an auomated / scripted process?
LVL 8
David SankovskySenior SysAdminAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mohammed KhawajaManager - Infrastructure:  Information TechnologyCommented:
If it is only one route then it is a very easy job.  What you need to do is the following:

1.  Create AD group and add computers to which you want to add the routes to
2.  Create a computer logon GPO to add the route via a batch file
3.  Apply the GPO to you domain level and apply it only to the group created in step one

The script file will look something like this:

route add -p x.x.x.x mask a.a.a.a y.y.y.y

x.x.x.x is the target, a.a.a.a is the subnet and y.y.y.y is the gateway
0
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
A simple method is to use PowerShell to generate and execute the route.exe commands, e.g. on the new server:
Get-WMIObject -ComputerName Win2003-PC Win32_IP4PersistedRouteTable |
   ? { $_.destination -ne '0.0.0.0' } |
   | % { route add -p $_.Destination mask $_.Mask $_.NextHop metric $_.Metric1 }

Open in new window

0
David SankovskySenior SysAdminAuthor Commented:
Thanks, I'll try it when I'm back at office and let you know.
One thing though... the computers are not in a domain - neither of them - so I can't really use "-ComputerName Win2003-PC" will it accept an IP address instead?
0
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
Yes, and you will have to use -Credentials and supply account info if different.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2003

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.