Page 1 of 2 12>
Topic Options
#44844 - 2003-09-05 04:28 PM How to check the connection to the local network ?
Philippe Offline
Fresh Scripter

Registered: 2001-06-21
Posts: 17
Loc: Poitiers, France
Hi guys,

I am looking for a consistant way to check if a workstation is on the network, or not. (not by just using @IPADRESS0) [Smile]

Regards

Top
#44845 - 2003-09-05 04:31 PM Re: How to check the connection to the local network ?
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
Wouldn't you need somthing link a ping? (I think the UDF forum contains some UDFs that do this.) Having a valid IP address doesn't necessarily mean the machine is attached to an operating network.

[ 05. September 2003, 16:32: Message edited by: Jack Lothian ]
_________________________
Jack

Top
#44846 - 2003-09-05 04:32 PM Re: How to check the connection to the local network ?
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
What do you mean by "on the network"? Also do you want the check done from a central server or at the client?
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#44847 - 2003-09-05 04:37 PM Re: How to check the connection to the local network ?
Philippe Offline
Fresh Scripter

Registered: 2001-06-21
Posts: 17
Loc: Poitiers, France
Not a nice way [Roll Eyes]

I am using this to check at the login the exectue different kind of login script (network, modem or stand alone).

henri@kixtart.nl told me that someone already post something about my question :

Forum: starters
Subject: How to check the connection to the local network ?
Who Replied: Jack Lothian

Top
#44848 - 2003-09-05 04:39 PM Re: How to check the connection to the local network ?
Philippe Offline
Fresh Scripter

Registered: 2001-06-21
Posts: 17
Loc: Poitiers, France
Sorry for the end of my answer.
Top
#44849 - 2003-09-05 04:48 PM Re: How to check the connection to the local network ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmm...
henri might want to change the e-mail addy.
like you might have quessed, it's automailer.

could you explain a little more.
as obvious, stand-alone logonscript is not possible.
as, to get the logonscript, the machine needs to already be logged on to the network.

what you mean by modem?
you talking about RAS connections?
_________________________
!

download KiXnet

Top
#44850 - 2003-09-05 04:52 PM Re: How to check the connection to the local network ?
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
Misunderstood your question. First by standalone you imply that there is no network logon, right? In this case your logon script never gets executed by the user & you can not help them. Thus you are really trying to detect RAS connections versus direct logons. This has been discussed several times before.

Is your reference about @IPADRESS0 related to to this posting by Howard?

Another board question.

Also, have you read the section on the @RAS function in the manual?

[ 05. September 2003, 16:58: Message edited by: Jack Lothian ]
_________________________
Jack

Top
#44851 - 2003-09-05 05:19 PM Re: How to check the connection to the local network ?
Philippe Offline
Fresh Scripter

Registered: 2001-06-21
Posts: 17
Loc: Poitiers, France
Well, sorry for my poor english, I will try to be clear [Smile]

We have W2K Prof as OS.
I defined the Local Policy for the user to execute the login script at the connection.

I completely bypass the netlogon process so I can
My login script is working has following :

When a user opens a session, the script defined in the policy is executed locally on the station.

I check if the station is on the network, on RAS or stand alone.
If it is on the network, I check which subnet it is, affect the server file depending on the subnet, then I update on the station all the required files to be executed for a RAS or stand alone session
then I do what a login script is for
- install sofware
- mount share drivers /printers
- configure desktop ...

If it is a RAS session,
I just mount the shares and configure the desktop or a stand alone session, I just configure the desktop [Smile]

I am just looking for a nice way to rapidly check what kind of session it is.
I already use @IPADRESS0, but in some case the result is not good (still the network adress)
and the script need to be run twice to get the rignt value
Exemple:
network session : 192.0.0.1
RAS session : 192.250.0.1
stand alone : 127.0.0.1 or EMPTY
Is it more clear [Smile]

Top
#44852 - 2003-09-05 05:29 PM Re: How to check the connection to the local network ?
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
Why don't you post your script plus tell us what version of kixtart you are running? I suspect this will get you the answer faster. When you post script code use "CODE" button in the "POST A REPLY" screen. This will improve the readability of the code.
_________________________
Jack

Top
#44853 - 2003-09-05 05:34 PM Re: How to check the connection to the local network ?
Philippe Offline
Fresh Scripter

Registered: 2001-06-21
Posts: 17
Loc: Poitiers, France
Well, I will put just the piece of code where I try to check connexion

...
code:
 
;
; Get the Current IP Adress
;
$IPAddress = @IPADDRESS0
$oct1 = LTRIM(SUBSTR($IPAddress, 1, 3))
$oct2 = LTRIM(SUBSTR($IPAddress, 5, 3))
$oct3 = LTRIM(SUBSTR($IPAddress, 9, 3))
$oct4 = LTRIM(SUBSTR($IPAddress, 13, 3))
$IPAdress = "$oct1.$oct2.$oct3.$oct4"
$oct1_int=0+$oct1
$oct2_int=0+$oct2
$oct3_int=0+$oct3
$oct4_int=0+$oct4
;
;
;
SET "ModeConnexion="
SELECT
CASE $oct1_int=127
Set "ModeConnexion=AUTONOME"
$MODECONNEXION="AUTONOME"
GOTO AUTONOME
CASE $oct1_int=10
IF ($oct2_int<>200)
Set "ModeConnexion=RESEAU"
$MODECONNEXION="RESEAU"
GOTO RESEAU
ELSE
Set "ModeConnexion=MODEM"
$MODECONNEXION="MODEM"
GOTO MODEM
ENDIF
CASE 1
Set "ModeConnexion=MODEM"
$MODECONNEXION="MODEM"
GOTO MODEM
ENDSELECT
...


Top
#44854 - 2003-09-05 05:42 PM Re: How to check the connection to the local network ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
for stand alone check, think this is enough:
if "%logonserver%"=@wksta
"local logon"
endif

not sure, but hey, give it a try [Big Grin]
_________________________
!

download KiXnet

Top
#44855 - 2003-09-05 05:44 PM Re: How to check the connection to the local network ?
Philippe Offline
Fresh Scripter

Registered: 2001-06-21
Posts: 17
Loc: Poitiers, France
thanks
i'll try it [Big Grin]

Top
#44856 - 2003-09-05 08:18 PM Re: How to check the connection to the local network ?
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
Would standalone computers always return an IP address of 127.0.0.1 or empty? Have you tested this?
_________________________
Jack

Top
#44857 - 2003-09-05 11:47 PM Re: How to check the connection to the local network ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
why should they?
I mean, even though they are stand-alone, they normally do have IP's
_________________________
!

download KiXnet

Top
#44858 - 2003-09-08 08:27 AM Re: How to check the connection to the local network ?
Philippe Offline
Fresh Scripter

Registered: 2001-06-21
Posts: 17
Loc: Poitiers, France
Sometimes I have nothing,
sometimes I have address given by the OS (192.????) as I remember, sometimes I have 127.0.0.1

Top
#44859 - 2003-09-08 08:39 AM Re: How to check the connection to the local network ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
127.0.0.1 should come only when computer has never been assigned an IP...
well, AFAIK.

anyway, all computers have 127... address and nothing should be counted on that.
as example, w2k machine that has been configured for dhcp and haven't reached the server will make a bogus IP for itself.

anyway, when logging locally, the logonserver nor the @ldrive are never other than local.

so, if these are local, in normal environment it means that the wksta is not logged on to the domain. at least not primarily.

now, your setup is far from normal so I have no confidence this will work either.
_________________________
!

download KiXnet

Top
#44860 - 2003-09-08 08:42 AM Re: How to check the connection to the local network ?
Philippe Offline
Fresh Scripter

Registered: 2001-06-21
Posts: 17
Loc: Poitiers, France
Thank you for your info.
I will work in that direction [Smile]

Top
#44861 - 2003-09-08 09:57 AM Re: How to check the connection to the local network ?
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
quote:
127.0.0.1 should come only when computer has never been assigned an IP...
well, AFAIK

Not quite. The 127.0.0.1 address is the loopback address, and this will always be present in the TCP/IP stack, although it should never be bound to a card. If you issue a "route print" you will see the 127.0.0.0 network and the 127.0.0.1 address.

It is a very important address, as it is effectively internal to your TCP/IP stack. This means (for instance) that you can test that you have networking installed by pinging this address, even if you don't have an active LAN or dial-up connection.

You can also develop network applications / web pages and whatever else while offline.

When you are connecting network applications on the same machine, such as a web browser and server, or an application to a database via pipes or ODBC you should always use the loopback address. This way the traffic won't hit the card and/or the network, and processing will be far faster.

Top
#44862 - 2003-09-08 10:43 AM Re: How to check the connection to the local network ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
should have quessed that answer [Wink]
I was totally referring to his:
quote:

Sometimes I have nothing,
sometimes I have address given by the OS (192.????) as I remember, sometimes I have 127.0.0.1

now, if @ipaddy gives that...

anyway, your comment is totally right [Big Grin]
_________________________
!

download KiXnet

Top
#44863 - 2003-09-09 12:08 AM Re: How to check the connection to the local network ?
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
just ping the default GW.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
Page 1 of 2 12>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 874 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.097 seconds in which 0.039 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org