Network connection default configuration

M

Mark K Vallevand

It looks like when a network connection is created, all the available
clients, services and protocols are assigned to it. Is this true?

If I need to configure the clients, services and protocols for a network
connection, I must do this using the GUI or netsh after FBA. I cannot do
this using Target Designer. Correct?
 
M

Mark K Vallevand

Another question.

I assume that if netsh and the GUI can manipulate all the settings for a
network connection, that I could write a program to do it, too. Correct?
Is the INetCfg set of APIs the correct place to start? Is there a component
needed to support the INetCfg?
 
M

Mark K Vallevand

The INetCfg API is in the file Netcfgx.dll, which is in the Primitive:
Netcfgx component (duh). It gets dragged in by something in my image, so
I'm good.

Answering my own questions.
 
D

Doug Hoeffel

Mark:

You could also use WMI:

Set WMIInterface = CreateObject("WbemScripting.SWbemLocator")
Set WMIServiceInterface = WMIInterface.ConnectServer(".", "Root\cimv2", "",
"")


Function SetStaticIP(adapterIndex, ipAddress, subNetMask)
queryString = "select * from Win32_NetworkAdapterConfiguration where Index
= " & adapterIndex
Set colNetAdapters = WMIServiceInterface.ExecQuery (queryString)

For Each objNetAdapter in colNetAdapters
errEnable = objNetAdapter.EnableStatic(ipAddress, subNetMask)
'errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)
Next
SetStaticIP = errEnable
End Function


Set WshShell = CreateObject("WScript.Shell")
vendor =
WshShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Services\E100E\Enum\0")
driverID = WshShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Enum\" & vendor &
"\Driver")
myArray = Split(driverID, "\")
netIndex = myArray(1)

strIPAddress = Array("192.168.42.38")
strSubnetMask = Array("255.255.248.0")

rc = SetStaticIP(netIndex, strIPAddress, strSubnetMask)

HTH... Doug
 
K

KM

Mark,

Yes, you are correct. There is currently no way to set this up from TD.

To script the network setup you can use netsh and snetcfg.exe tools.
Or use API directly, or even change some dynamic network reg.settings.
 

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