Hello everyone,
here's a little challenge I've been working on..
1. We are building our servers using a combination of WinPE and a
bunch of batch scripts.
2. When we boot into WinPE, launch an .HTA file that prompts the user
to enter some information, including
IP address, subnet mask and default GW.
3. That information should be applied to the active NIC (the one with
the cable plugged into it), a few scripts run
and then the system reboots and another HTA runs that brings up
additional information asking the type of
config, any additional software installed, etc.
Here's the issue:
The information entered into the initial boot info should be applied
to the active NIC. The active NIC should be enumerated correctly and
the IP address applied to that NIC and all is good. However,
occassionally with some of the newer Compaq servers with virtual
hardware, the NICs are enumerated backwards so the IP address
configured initially is applied to the wrong NIC.
So using this script (see below) doesn't always work because IP
enabled will return both NICs
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colAdapters = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=
True")
Most of the time the first one it returns is the correct one,
occasionally it's reversed though, and that creates the issue.
What I'd like to do is get the results similar to what is returned
when using the getmac.exe utility., so I can parse for the adapter
that DOESN"T return "media disconnected". This adapter will always be
the one that is active (plugged in) and I can then set the IP to that
adapter based on MAC address.
So the question is, is there a way to return MEDIA DISCONNECTED using
a WMI call?
Thanks in advance!!
Regards,
Christopher Rees
Palaestra Training
www.palaestratraining.com
1-800-324-0946