Information Technology Reference
In-Depth Information
be based on
netsh routing
. This syntax is documented on the Microsoft website and can be
viewed by issuing the
netsh routing help
command. You must have administrator-level
permissions on the server in order to fully use these commands.
To access the
netsh routing
interface for the local server, open a command prompt and
issue the following command:
> netsh routing
To access the help menu for
netsh routing
, just append the
help
parameter to the command:
> netsh routing help
Using VBScript
Unfortunately, there is no built-in scripting interface through which to administer RRAS.
However, you can call the
netsh routing
command-line functions from a VBScript using the
following syntax:
' This code will instantiate a WSH object and execute the desired command.
' ------ SCRIPT CONFIGURATION ------
' Enter the desired netsh routing command between the quotation marks
' in the line below, for example:
strCommand = "netsh routing ip reset"
' ------ END CONFIGURATION ---------
set objShell = CreateObject("WScript.Shell")
set objExec = objShell.Exec(strCommand)
' Run in a loop while the command is executing
Do While objExec.Status = 0
WScript.Sleep 1000
Loop
' Delete the objects from memory once the command is completed.
Set objExec = Nothing
Set objShell = Nothing
WScript.Echo ("Command completed successfully")
Because this syntax is the same regardless of the
netsh routing
command or parameters,
we will not discuss this method in each recipe. Instead, you should refer to the sections of
recipes that describe using a command line and then place the appropriate command into the
previous script.
5-1. Enabling and Configuring a Network Address
Translation Router
Problem
You want to enable RRAS and provide a method for your internal clients to access the Internet
using a single, public IP address.