Page 1 of 1 1
Topic Options
#202731 - 2011-07-26 09:23 AM Interface addresses not refreshed while script executes
yellowdog Offline
Starting to like KiXtart

Registered: 2005-06-14
Posts: 102
Hello,

I wrote a little script that checks the interface connected to the network using the @IPADRESSx macro.
I have two interface (ethernet and wifi), then I check
@IPADRESS0 and @IPADRESS1 to see if it's initialized with the correct subnet.
The problem is that, if during the script one interface is set down, it still detects that interface UP, and if at the begining of the script one is down and then set to UP, it's never detected as UP.

Why the @IPADRESSx macro does not interrogate the interface status dynamically? is that a bug ?

How to fix that problem ?


Thanks

Top
#202732 - 2011-07-26 12:44 PM Re: Interface addresses not refreshed while script executes [Re: yellowdog]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
All macro's (@USERID, @WKSTA, @IPADDRESSx, etc...) are set when kix32 or wkix32 starts. During a kix session they are not updated. There is no way to force an update of the macro's.

You could use WMI to get the IP address.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#202733 - 2011-07-26 02:50 PM Re: Interface addresses not refreshed while script executes [Re: Mart]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
The NicInfo() UDF will query a host and return an array of arrays containing the current adapter status/information. It uses a combination of registry and WMI data.

There's a fairly simple example of how to use it in the header. The outer array represents each NIC, and the inner array contains the data for the adapter. The MAC Address value - $aNICData[#][16] - is empty if the adapter is disabled or not connected.

Version 1.4 is the latest and can be downloaded from the Resources/Kix Library section of my web site. The versions posted here aren't always the latest revision.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#202734 - 2011-07-26 04:55 PM Re: Interface addresses not refreshed while script executes [Re: Glenn Barnas]
yellowdog Offline
Starting to like KiXtart

Registered: 2005-06-14
Posts: 102
Thank you very much for the answer, I'm gonna work on it. ;\)
Top
Page 1 of 1 1


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

Who's Online
0 registered and 507 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.13 seconds in which 0.069 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