The @RAS macro, when it works, only identifies active session of the NT Remote Access Service. To easily identify remote users for all operating systems, you can do it by ip range.Example, let's say your company has a range of IPs for lan users (10.0.0.1 - 10.0.0.200)
and remote users (10.0.0.201 - 10.0.0.254). You could identify them like this:
-----------------------------------------------------------------
;This section correctly breaks up and formats an IP address (bonus script)
$OCT1 = LTRIM(SUBSTR(@IPADDRESS0, 1, 3))
$OCT2 = LTRIM(SUBSTR(@IPADDRESS0, 5, 3))
$OCT3 = LTRIM(SUBSTR(@IPADDRESS0, 9, 3))
$OCT4 = LTRIM(SUBSTR(@IPADDRESS0, 13, 3))
$IP = "$OCT1.$OCT2.$OCT3.$OCT4"
$CTYPE = "LAN" ;CTYPE is the variable that indicates a LAN or RAS user
IF $OCT1="10" and $OCT2="0" and $OCT3="0"; Valid network user
IF $OCT4>"200" and $OCT4<"255"; ; Remote user detected
$CTYPE = "RAS"
ENDIF
ELSE ; Unauthorized network user
? "What are you doing here!"
$RCODE = LOGOFF(1) ; Logoff this spy!
ENDIF
? "$IP detected as $CTYPE user."
-------------------------------------------
Examples like this and many more are in my new scripting book called "Windows Admin Scripting." This book covers advanced WSH, KiXtart, Shell Scripting, AutoIt, ScriptIt, ADSI, WMI, logon scripting, and more. This book is really cool because it focuses on the topics and areas we deal with everyday. If you want to script it, its in here.
Here's the link: http://www.coriolis.com/store/product.asp?sku=1241 http://www.amazon.com/exec/obidos/ASIN/1576108813/