NIC Enumeration ?


R

Ralph

I have the script below I am using to rename a network adapter after
resealing a system. All of the computer's hardware is supposed to be
the same but when the cloned image is installed it will sometimes
enumerate the NIC as a new device. I want to rename the nic to
"INTERNET" and set the IP after it reseals so when it reboots and
enumerates the new devices are configured per below. Problem is that
sometimes the new NIC is labeled "Local Area Connection 2" and the
script fails. Is there a way to get netsh to check for the name or
add a wildcard? I tried "*" but that too did not correctly ID the
device.

Thanks,

REB

@Echo off
Title XP Embedded UIC Post Reseal Configuration Utility.
Color 1F
cls

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:
: :
: Description: Automated script designed to configure the local network adapter with an IP :
: address of 192.168.1.1 with Subnet Mask 255.255.255.0. Additionally the script should rename :
: the connection to "Internet". : :
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:Rename adapter to "ToMMC"
Echo Renaming local network connection from Local Area Connection to
"Internet"...
netsh interface set interface name="Local Area Connection"
newname="Internet"

:Set the IP address to "192.168.1.1" with subnet of 255.255.255.0.
Echo Setting IP address to 192.168.5.3...
netsh interface ip set address "Internet" static 192.168.1.1
255.255.255.0 192.168.1.1 1
 
Ad

Advertisements

K

K

Ralph,

You can use the following VBScript to enumerate the network
connections

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.NameSpace(NETWORK_CONNECTIONS)

Set colItems = objFolder.Items
' Goes through every connection, etc.
For Each objItem in colItem
'set the name, ala: objItem.Name = "INTERNET"
Next

Kris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top