I'm a Linux guy. I have a pretty specific problem I'm trying to solve on a Windows box, so please forgive my ignorance here.
PROBLEM (this can't be redefined): I have a windows machine that has 3 NICs. Each time it is booted, I need a way to dynamically and automatically set its IP addresses. Each time this machine is booted, it will have different address information. The machine will have a file consisting of name/value pairs accessible to it when it starts up (i.e. a file full of "=" entries). I need to perform all these tasks using standard windows command prompt commands run from a batch file. I don't have VB or anything available to me.
BIGGEST ISSUE: This would be much easier, I think, if Windows was deterministic with the naming of its network interfaces. If it was, I could parse this file and simply set, say, "Local Area Connection 2"'s IP address using netsh. As it stands, though, Windows will sometimes move around the names it uses for your physical NICs. So what's "Local Area Connection 2" today may just be "Local Area Connection" tomorrow. So, I have to find a way to determine these things during startup by using the MAC address and finding the corresponding NICs. Without grep, awk, etc, snagging this information from the ipconfig output is becoming increasingly difficult.
WHAT I'VE TRIED/ACCOMPLISHED: (1) I've figured out how to kick off my batch file during windows startup by adding a windows setting startup script through the local group policy editor. (2) I've figured out how to, from a batch file, parse my name/value pair file and grab the tokens. (3) I've tried using the arp command to set the ip mapping. This, as is obvious, simply routes packets correctly to an interface. Once the packets hit the interface, though, they get dropped because the packets are intended for a network that the NIC doesn't belong to. This does me no good. I need to set the ip addresses for the NICs.
MY CURRENT PLAN / WHAT I NEED HELP WITH: (1) Parse my name/value pair file (2) Find the names of the network cards that correspond to the mac addresses in the name/value pair file (3) Use netsh to set the ip addresses of these cards (4) Do this all from a batch file (5) Try not to complain as much that I'm not using a Linux box :-)
Any help is greatly appreciated.