How to Automate Your RAS Login
Microsoft's Remote Access Services (RAS) is a powerful connectivity tool for
wide-area connections for numerous applications, including remote connectivity
to a Windows NT Server and connectivity from a Windows NT Workstation or Server
system to the Internet, CompuServe, and other online systems. Unfortunately, RAS
has little integrated support for non-Microsoft connections. For example, if you
use the standard RAS setup to dial in to the Internet or CompuServe, you have to
invoke the RAS Terminal interface to manually log in to the service.
Fortunately, Microsoft lets you automate this process. To automate logins, you
can create scripts and store them in the switch.inf file. This text file is in
the %SYSTEMROOT%\SYSTEM32\RAS directory (%SYSTEMROOT% is the drive and topmost
directory for your Windows NT software; e.g., C:\WINNT35.
Because the default switch.inf file contains several explanations,
suggestions, and examples, get acquainted with this file before you start
editing it. Also, back up the file before you start altering it.
To create a new script, you define a section header (a title) for it. The
section header can be anything--it is only a configuration item in your RAS
phone book entry. Then you need to know exactly what the connecting network
expects to send and receive during the login process. To get this information,
use the RAS Terminal interface, turn on screen capture, and complete the login
process manually. You can then develop an automated script from the information
you record in the capture file.
RAS Scripts
Each script starts with a section header and then has command and response
entries. Table 1 lists and explains the various commands. To document the
script, you can add comments, which start with a semicolon.
Below is a typical RAS login script. For this script to work, you must
replace the strings myusername and mypassword with a valid username and
password.
[Xylogics Annex Three]
; Wait until you get the "USERNAME:" prompt
COMMAND=
ERROR_NO_CARRIER=<match>"NO CARRIER"
OK=<match>"AME:"
; Send the USERNAME
COMMAND=MYUSERNAME<cr>
ERROR_NO_CARRIER=<match>"NO CARRIER"
;wait for "PASSWORD:" prompt
OK=<match>"ORD:"
; Send the PASSWORD and ignore response
COMMAND=MYPASSWORD<cr>
ERROR_NO_CARRIER=<match>"NO CARRIER"
; Wait for "Annex>" send the PPP command
OK=<match>"nnex>"
COMMAND=PPP<cr>
ERROR_NO_CARRIER=<match>"NO CARRIER"
; Wait for the Annex to start up PPP mode
CONNECT=<match>"Switching to PPP"
ERROR_DIAGNOSTICS=<cr><lf><Diagnostics>
ERROR_DIAGNOSTICS=<lf><cr><lf><Diagnostics>