I have spent some time on this for our W9x clients.First I tried to use @RAS but it can't determine if a user is coming into the network via a vpn connection to their ISP.
Then I thought well i'll just check the value of their IP address using @IPADDRESS. The problem with this is that if the user still has their pcmcia card in the laptop and they don't have a separate hardware profile or they have started their laptop in the "network" profile, @IPADDRESS will find the IP Address of the NIC instead of the PPP Adapter.
What I ended up doing which I feel is the definitive way to determine if they are networked or dialing in is to redirect the output of WINIPCFG to a file, parse it until the line PPP Adapter is found, then continue parsing until the line IP Address is found. If it is 0.0.0.0 then they are local.
It is a little klugy but it works.
Hope this helps