Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords:
OS: WinNT4.0 SP3 or SP4 I wan't to check in the logon script if the user connected to the network using RAS.
We are not using a RAS server localy (authentication is done in an other country) so I can't check the server and there by I have to check the workstation. I'm thinking if it is possible to use WinBatch to check if the Modem driver is active or not. That way I can assume that if the modem driver is running the user connected thru RAS.
if WinExist("Connected To")If everyone has MSIE 5.0 you can try the new WinInet iGetConStateEX function.
First I check the OS type 'cause it's different in NT vice Win 9x
OStype = WinMetrics(-4) IF OStype <> 4 && OStype <> 5 ; Is it Win NT or Win 9x ? exit ; if its NOT either we leave endif wsd = DirWindows (1) ; gets the windows system directory we use this in a number of places wd = DirWindows (0) ; gets the windows directory we use this in a number of places IF OStype == 4 ; Win NT IF RegExistKey(@REGMACHINE, "System\CurrentControlSet\Services\RemoteAccess" ) ; This key does NOT exist unless DUN is installed ; so if it's NOT there the PC CAN'T be dialing in ndis_ctr = "" ; initialize counter -- minor problem -- it starts with just PLAIN NdisWan While ndis_ctr < 10 ; there's an indeterminate number of NdisWan# keys -- have seen up to NdisWan6 we will check NdisWan thru NdisWan9 IF RegExistValue(@REGMACHINE, "System\CurrentControlSet\Services\NdisWan%ndis_ctr%\Parameters\Tcpip[DhcpIPAddress]" ) goto warning ; the above key ONLY exists during an active connection to a dial-in server so as soon as we find it we KNOW we've dialed in endif ; so we jump to the warning If ndis_ctr == "" ; minor problem -- it starts with just PLAIN NdisWan this section sets it to 1 ndis_ctr = 1 else ; once it's a number rather than "empty" or "" ndis_ctr = ndis_ctr + 1 ; we can increment it endif endwhile ; if we get all the way through this while loop without jumping to warning we must be connected by LAN endif endifHere's the Win 9x code, which is simpler:
if RegExistValue(@REGMACHINE, "System\CurrentControlSet\Services\RemoteAccess[Remote Connection]") ; check for the value val = RegQuerybin( @REGMACHINE, "System\CurrentControlSet\Services\RemoteAccess[Remote Connection]" ); if it's there we'll get the value IF val == "01 00 00 00" ; the value IS dynamic, i.e. when connected, it's 01 00 00 00, and when NOT connected it's 00 00 00 00 :warning ; to jump here from the NT section to save code space & display a warning notice & then exit the script. ButtonPushed=Dialog("WarningDialog") IF ButtonPushed == 1 exit ; wait until they click "OK" to leave the script endif endif endif
Article ID: W14626
Filename: Determine if a User is Logged in via RAS.txt
File Created: 2000:11:14:13:30:34
Last Updated: 2000:11:14:13:30:34