I am trying to automate ms loopback adapter install and was able to automate the install fine using DevCon.exe.

devcon install C:\Windows\inf\netloop.inf *MSLOOP

now this works fine. After installation I would like to configure the adapter and I was able to do this with little problems as long as I know that the adapters name is going to be "Local Area Connection 2" using the NetSh.exe.

netsh interface ip show address name="Local Area Connection 2" 192.168.1.99 255.255.255.0
alright, now we are getting somewhere. But and this is a big but... I immmediatley thought what if one of our users decided to install a wireless card or some other networking device that already took the name "Local Area Connection 2" ? This will break the config portion for those particular users. No problem i thought I can just throw a quick reg hack in and rename it there. Another problem. The regkey contains what appears to be a random GUID as shown here:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\{907838C0-C900-493A-8930-60D59083E550}\Connection]
"Name"="MS Loopback Adapter"

The {4D36E972-E325-11CE-BFC1-08002BE10318} is consistent, but the second guid appears to just be randomly generated.

So does anyone here have any ideas of how I can rename this connection to say "MS Loopback Adapter" so I can run the NetSh command with a unique identifier?

Any ideas or thoughts would be greatly appreciated!!!

Thanks,

Todd
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
Maybe you can include a vbscript in a custom action to check the last "objNicConfig.Index" as it would be the newest network interface. You could then use vbscript to execute a shell command referencing the 'objNicConfig.Description'.

I am on a boring support call and browsing the appdeploy forums right now. I appologize if this answer seems half baked... [;)]

VBScript to look at interfaces
[link]http://www.microsoft.com/technet/scriptcenter/topics/networking/03_atnc_remote.mspx[/link]

On Error Resume Next

dim theMessage

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colNicConfigs = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration")

For Each objNicConfig In colNicConfigs
theMessage = theMessage & vbcrlf & "Network Adapter " & objNicConfig.Index & " (" & objNicConfig.Description & ")"
theMessage = theMessage & vbcrlf & " IP Address(es):"
For Each strIPAddress In objNicConfig.IPAddress
theMessage = theMessage & vbcrlf & " " & strIPAddress
Next

theMessage = theMessage & vbcrlf & " Subnet Mask(s):"
For Each strIPSubnet In objNicConfig.IPSubnet
theMessage = theMessage & vbcrlf & " " & strIPSubnet
Next
Next

wscript.echo theMessage
Answered 07/20/2005 by: Garrett
Orange Belt

Please log in to comment
0
thanks garret, this helped me get through the problem.

here is what i used.



Const NETWORK_CONNECTIONS = &H31&
Set WshShell=Wscript.CreateObject("Wscript.shell")
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(NETWORK_CONNECTIONS)
Set objFolderItem = objFolder.Self
Wscript.Echo objFolderItem.Path

Set colItems = objFolder.Items
LastCnt = colItems.Count
LastOne = colItems.Item(LastCnt-1).Name
Wscript.Echo "Last name is " & LastOne

WshShell.run "netsh interface ip set address name=" & Chr(34) & LastOne & Chr(34) & " source=static 192.168.5.99 255.255.255.0"


thanks again!!
Answered 07/21/2005 by: indica
Yellow Belt

Please log in to comment
0
Hello everybody!


Ok - indica's asked the question is some time ago <g> - today i tried to do the same thing. I found an IMHO fine solution in the "Hey, Scripting Guy" article from 2005-05-11. You can read this article at

http://www.microsoft.com/technet/scriptcenter/resources/qanda/may05/hey0511.mspx

Hope this will be useful for somebody out there ...


Have a fine time ...


Reinhard

PS: the answer is 42!
Answered 02/22/2007 by: MrWinstonWolf
Yellow Belt

Please log in to comment
Answer this question or Comment on this question for clarity