yellowdog
(Starting to like KiXtart)
2011-07-26 09:23 AM
Interface addresses not refreshed while script executes

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


Mart
(KiX Supporter)
2011-07-26 12:44 PM
Re: Interface addresses not refreshed while script executes

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.


Glenn BarnasAdministrator
(KiX Supporter)
2011-07-26 02:50 PM
Re: Interface addresses not refreshed while script executes

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


yellowdog
(Starting to like KiXtart)
2011-07-26 04:55 PM
Re: Interface addresses not refreshed while script executes

Thank you very much for the answer, I'm gonna work on it. ;\)