The laptops used at work frequently need to be re-configured to access HTML service interfaces via Ethernet in a number of different devices (radios, data recorders and such).
So that the webpage-like interfaces can be opened in a browser window the LAN's TCP/IP interface needs to have appropriate static Network, Subnet and IP address set and of course each manufacturer has their own preferences.
The laptops use WinXP Pro and do have one alternate set of IPs that will be applied if a DHCP connection fails but that's not enough!
I'm putting together a utility program that will allow selection from a list of devices and will then automatically set the LAN IP addresses to suit.
So far I'm shelling to Netsh.exe and achieving the required setup with eg..
Once a netsh command has been sent to change the IP addresses, I can send another to check the new settings..
The results can then be sent either to a text file or a named pipe for subsequent parsing.
I tried reading the current / newly set IPs using Ipconfig.exe but found that it doesn't actually show the network adapter's static IP Address and NetMask unless there is an active network connection.
The same seems to apply when using the API GetAdaptersInfo() (eg http://www.powerbasic.com/support/fo...ML/013729.html ), whereas Netsh.exe does reveal the adapter's Static IP addresses.
This is probably more of a nuisance while I'm developing the program than it would be in actual use but still, I would prefer to use an API solution something like GetAdaptersInfo rather than the command shell if I can find one that works as well as Netsh.exe does.
Can anyone suggest other (API?) methods for setting and reading a network adapter's TCP/IP properties?
So that the webpage-like interfaces can be opened in a browser window the LAN's TCP/IP interface needs to have appropriate static Network, Subnet and IP address set and of course each manufacturer has their own preferences.

The laptops use WinXP Pro and do have one alternate set of IPs that will be applied if a DHCP connection fails but that's not enough!
I'm putting together a utility program that will allow selection from a list of devices and will then automatically set the LAN IP addresses to suit.
So far I'm shelling to Netsh.exe and achieving the required setup with eg..
Code:
CommandLine = "netsh interface ip set address "+$Dq+"Local Area Connection"+$Dq+ _ " static "+IPAddress+" "+NetMask Shell Environ$("comspec") & " /C " & CommandLine, 0
Code:
CommandLine = "netsh interface ip show config"..
I tried reading the current / newly set IPs using Ipconfig.exe but found that it doesn't actually show the network adapter's static IP Address and NetMask unless there is an active network connection.
The same seems to apply when using the API GetAdaptersInfo() (eg http://www.powerbasic.com/support/fo...ML/013729.html ), whereas Netsh.exe does reveal the adapter's Static IP addresses.

This is probably more of a nuisance while I'm developing the program than it would be in actual use but still, I would prefer to use an API solution something like GetAdaptersInfo rather than the command shell if I can find one that works as well as Netsh.exe does.
Can anyone suggest other (API?) methods for setting and reading a network adapter's TCP/IP properties?
Comment