Код:
Const HKLM = &H80000002
Const NetBase = "SYSTEM\CurrentControlSet\Control\Network\"
Set oAdapters = GetObject("winmgmts:").ExecQuery("SELECT * " & _
"FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=True")
Set oReg = GetObject("winmgmts:\\.\root\default:StdRegProv")
iRC = oReg.EnumKey(HKLM, NetBase, aRegKeys)
For Each oAdapter In oAdapters
For Each sKey In aRegKeys
sKeyName = NetBase & sKey &"\"& oAdapter.SettingID &"\Connection"
oReg.GetStringValue HKLM, sKeyName, "Name", sValue
If sValue = "Подключение по локальной сети" Then
oReg.SetStringValue HKLM, sKeyName, "Name", "LAN1"
oReg.SetDWORDValue HKLM, sKeyName, "ShowIcon", 1
oReg.SetDWORDValue HKLM, sKeyName, "IpCheckingEnabled", 1
End If
If sValue = "Подключение по локальной сети 3" Then
oReg.SetStringValue HKLM, sKeyName, "Name", "LAN3"
oReg.SetDWORDValue HKLM, sKeyName, "ShowIcon", 1
oReg.SetDWORDValue HKLM, sKeyName, "IpCheckingEnabled", 1
End If
Next
Next