Windows NT RAS Scripting

Steve Scoggins directs you to the Internet with scripts to automate RAS login.

Steve Scoggins

April 30, 1996

4 Min Read
ITPro Today logo

How to Automate Your RAS Login

Microsoft's Remote Access Services (RAS) is a powerful connectivity tool forwide-area connections for numerous applications, including remote connectivityto a Windows NT Server and connectivity from a Windows NT Workstation or Serversystem to the Internet, CompuServe, and other online systems. Unfortunately, RAShas little integrated support for non-Microsoft connections. For example, if youuse the standard RAS setup to dial in to the Internet or CompuServe, you have toinvoke the RAS Terminal interface to manually log in to the service.Fortunately, Microsoft lets you automate this process. To automate logins, youcan create scripts and store them in the switch.inf file. This text file is inthe %SYSTEMROOT%SYSTEM32RAS directory (%SYSTEMROOT% is the drive and topmostdirectory 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 startediting it. Also, back up the file before you start altering it.

TABLE 1: Here is a list of RAS script commands.

To create a new script, you define a section header (a title) for it. Thesection header can be anything--it is only a configuration item in your RASphone book entry. Then you need to know exactly what the connecting networkexpects to send and receive during the login process. To get this information,use the RAS Terminal interface, turn on screen capture, and complete the loginprocess manually. You can then develop an automated script from the informationyou record in the capture file.

RAS ScriptsEach script starts with a section header and then has command and responseentries. Table 1 lists and explains the various commands. To document thescript, you can add comments, which start with a semicolon.

Below is a typical RAS login script. For this script to work, you mustreplace the strings myusername and mypassword with a valid username andpassword.

[Xylogics Annex Three]

; Wait until you get the "USERNAME:" prompt

COMMAND=

ERROR_NO_CARRIER="NO CARRIER"

OK="AME:"

; Send the USERNAME

COMMAND=MYUSERNAME

ERROR_NO_CARRIER="NO CARRIER"

;wait for "PASSWORD:" prompt

OK="ORD:"

; Send the PASSWORD and ignore response

COMMAND=MYPASSWORD

ERROR_NO_CARRIER="NO CARRIER"

; Wait for "Annex>" send the PPP command

OK="nnex>"

COMMAND=PPP

ERROR_NO_CARRIER="NO CARRIER"

; Wait for the Annex to start up PPP mode

CONNECT="Switching to PPP"

ERROR_DIAGNOSTICS=

ERROR_DIAGNOSTICS=

Below is a more complex RAS script for a Point-to-Point Protocol (PPP)login to CompuServe Information Service (CIS). You must replace the XXXXX,XXXXstring with your CIS ID and the mypassword string with your password.

[CompuServe]

; get to the host name prompt

COMMAND=

OK=":"

; log on to the CIS network

COMMAND=CIS

; check for username prompt

OK=":"

; enter the username

COMMAND=XXXXX,XXXX/GO:PPPCONNECT

; check for the password prompt

OK=":"

; enter the password

COMMAND=mypassword

; finish

OK=

If you have problems with your script running before the remote system isready to respond, add a delay of two seconds. Insert the following code at thestart of your script below the section header.

COMMAND=

To skip two lines of text from the remote system, enter the followingcommands.

COMMAND=

OK=

COMMAND=

OK=

Some providers have a long login banner before the username prompt. TheLOOP command lets you ignore such a banner before you get the username prompt.Enter

COMMAND=

OK="sername"

LOOP=

COMMAND=myusername

Some PPP/Serial Line Internet Protocol (SLIP) servers require you to send acarriage return to wake the server. To do so, add this command after the sectionheader:

COMMAND=

Activating Your ScriptAfter you create a login script and store it in the switch.inf file, toactivate it, follow these steps:

To troubleshoot a RAS login script, enable the device.log file. Reviewingit after a failed login gives you an idea of where to modify your switch.infscript to make your login script work correctly. To activate the device.logfile:

Logging will not begin until you exit RAS and restart the RAS program. Thecommands sent to your modem and the responses will be logged in a file nameddevice.log in the %SYSTEMROOT%SYSTEM32RAS directory.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like