Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


May 1996

Windows NT RAS Scripting


RSS
Subscribe to Windows IT Pro | See More Remote Access Service (RAS) Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

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.

TABLE 1: Here is a list of RAS script commands.
<cr>	Carriage return
<lf>	Line feed
<match>"abcdef"	Waits for match to "abcdef"
<ignore>	Ignores the rest of the response
<?>	Wildcard character
<hNN>	Used to represent a hexadecimal value containing the digits NN
<diagnostics>	Displays a diagnostic message box
OK=value	Defines the expected response
COMMAND=value<cr>	Sends the text string "value"
NoResponse	No response is expected
CONNECT=value	Terminates the script when the "value" is received
ERROR_NO_CARRIER=value	Checks for the loss of the modem carrier
ERROR_DIAGNOSTICS=value	Checks for diagnostic messages
LOOP=value	Loop waiting for a match value

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>

   Previous  [1]  2  Next 


Top Viewed ArticlesView all articles
No Jobs, No Excitement at Apple's Last Macworld Keynote

Apple CEO Steve Jobs made the right move in skipping out on his company's last appearance at Macworld: In a Tuesday keynote address at the conference, Apple had no interesting new products to sell, opting instead to spend mind-numbing amounts of time on ...

Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

Where is Microsoft NetMeeting in Windows XP?

...


Task Automation Whitepapers Essential Guide to E-discovery and Recovery for Microsoft Exchange

Continuous Data Protection and Recovery for Microsoft Exchange

Protecting (You and) Your Data with Exchange Server 2007

Related Events Virtualization Forum: Optimizing Storage, Networks, Desktops, and Security

Cloud Computing Forum: Integrating Software, Server and Storage as a Service into Your Enterprise IT Delivery Model

Virtualization Forum: Optimizing Storage, Networks, Desktops, and Security

Check out our list of Free Email Newsletters!

Task Automation eBooks Spam Fighting and Email Security for the 21st Century

A Guide to Windows Certification and Public Keys

Keeping Your Business Safe from Attack: Patch Management

Related Task Automation Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2009 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing