How to Determine Whether a Client Is Connected by RAS or LAN

ID: Q173530


The information in this article applies to:
  • Microsoft Windows NT Server versions 3.51, 4.0
  • Microsoft Windows 2000 Server
  • Microsoft Windows 2000 Advanced Server


SUMMARY

You may want to know whether a user is connected by Remote Access Service (RAS) or to the local area network (LAN) if you use logon scripts to map drives or to set environment variables when a user logs on to a domain. This can be especially helpful if the logon script contains a large number of commands. This article discusses one method of determining if a user is connecting by RAS.


MORE INFORMATION

Microsoft Systems Management Server includes a utility, Netspeed.com, that checks to see if a user has a slow connection. This utility, however, does not verify that there is an active RAS connection on the client.

NOTE: CheckRas.exe is not included with the Back Office Resource Kit 4.5.

For more information on Netspeed.exe, please see the following article in the Microsoft Knowledge Base:

ARTICLE-ID: Q131011
TITLE : SMS: NETSPEED.COM Internals

The BackOffice Resource Kit includes Checkras.exe, a utility that checks for RAS connections on the client instead of trying to determine the link speed. You can use the Checkras.exe utility in your logon script to check whether a user is connected by a RAS connection, and then include commands in your logon script based on the results returned by Checkras.exe.

The following is a sample Windows NT domain logon script that uses Checkras.exe:



@echo off
 echo Checking for existence of RAS Files

 if exist %windir%\system32\RASAPI32.DLL goto ras_status
 if exist %windir%\system\RASAPI32.DLL goto ras_status
 goto notras

 :ras_status
 echo Checking for existence of Checkras.exe
 if exist %windir%\checkras.exe goto yes_checkras
 copy \\server\netlogon\checkras.exe %windir%

 :yes_checkras
 echo Checking for RAS connection
 %windir%\checkras
 if errorlevel 1 goto ras
 echo This is not a RAS connection
 goto end

 :notras
 echo RAS is not installed on this system
 goto end

 :ras
 echo RAS connection detected
 REM Enter RAS specific command here.

 :end 

Additional query words: sms

Keywords : kbinterop kbnetwork ntdomain kbhowto NTInterop nthowto ntnetserv kbinfo NTSrv
Version : WINDOWS:2000; winnt:3.51,4.0
Platform : WINDOWS winnt
Issue type : kbhowto kbinfo


Last Reviewed: February 3, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.