Route Add command in login script

I have a login script that maps network drives and printers, can I add a standard command prompt that runs a ROUTE ADD command, or do I need to do it in another file and call the file to run in the vbs script?

Kevin SmithAsked:
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.

You should be able to run it directly from the script.


Kevin SmithAuthor Commented:
Cool...also, is it better to do that from a script, or just make the command persistant on each workstation (upped the points by 25 for the added question?
You should be fine to add it to the logon Script.
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

What do you need an additional route in a workstation for?  Shouldn't your Layer 3 networking equipment be taking care of this?
Kevin SmithAuthor Commented:
My Firebox isn't accepting my routing table for some reason and time is an issue...I'm using the route add as a quick and dirty method of getting an application to work so it'll give me time to figure out the Firebox issue.
I wouldn't make it persistent, no.  It'll run each logon so that takes care of having it there each time.  At some point you will correct the switch problem and at that point rather than deleting persistent routes you simply have to remove the line from the script.

Kevin SmithAuthor Commented:
I get an error when I add it directly in the vbs script...??
You didn't mention it was VBScript.

You can't call it directly in VBScript since this a an External command from the scripting engine.

This snipit should do it.  Just change the details in the route.

Set objShell = WScript.CreateObject("WScript.Shell")
wscript.sleep 100
Set objExecObject = objShell.Exec("%comspec% /c route add mask ")


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
My apologies - you did mention VBScript and I missed that.

The above should sort you out.

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.