Alla fin fine, con l'aiuto di S. Google, non era nemmeno troppo difficile:
codice:
'Usa il comando runas per poter eseguire lo script su Windows Vista/7/8
Set WshShell = WScript.CreateObject("WScript.Shell")
If WScript.Arguments.length = 0 Then
Set ObjShell = CreateObject("Shell.Application")
ObjShell.ShellExecute "wscript.exe", """" & _
WScript.ScriptFullName & """" &_
" RunAsAdministrator", , "runas", 1
End If
'Recupera l'indirizzo IP
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colItems = objWMIService.ExecQuery ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
Set colNetworkAdapters = objWMIService.ExecQuery ("Select * from Win32_NetworkAdapter")
Dim connectionName(32)
iCount = 0
For Each netAdapter in colNetworkAdapters
adapterMacAddress = netAdapter.MACAddress
If Not IsNull(netAdapter.NetConnectionID) Then
'WScript.Echo netAdapter.NetConnectionID & " " & netAdapter.MACAddress
connectionName(iCount) = netAdapter.NetConnectionID
iCount = iCount + 1
End If
Next
iCount = 0
For Each objItem In colItems
strIP = objItem.IPAddress(0)
'strName = objItem.Description(0)
'Recupera l'ultimo ottetto
strLastOctect = Right(strIP, Len(strIP)-InStrRev(strIP,"."))
'WScript.Echo strIP & " " & strName
'netsh interface ip set address name="Connessione alla rete locale (LAN) 2" source=static addr=100.1.2.57 mask=255.255.255.0 gateway=100.1.2.1
'netsh interface ip set dns name="Connessione alla rete locale (LAN) 2" source=static addr=100.1.2.202
'netsh interface ip add dns name="Connessione alla rete locale (LAN) 2" addr=100.1.2.204
'netsh interface ip set wins name="Connessione alla rete locale (LAN) 2" source=static addr=100.1.2.204
'netsh interface ip add wins name="Connessione alla rete locale (LAN) 2" addr=100.1.2.202
LANInterfaceName = connectionName(iCount)
newIPClass = "100.1.2."
strDNS1 = newIPClass & "202"
strDNS2 = newIPClass & "204"
strWINS1 = newIPClass & "204"
strWINS2 = newIPClass & "202"
strGateway = newIPClass & "1"
strNetshInterfaceCommand = "netsh interface ip set address name=" & """" & LANInterfaceName & """" & " source=static addr=" & newIPClass & strLastOctect & " mask=255.255.255.0 gateway=" & strGateway
strNetshDNS1Command = "netsh interface ip set dns name=" & """" & LANInterfaceName & """" & " source=static addr=" & strDNS1
strNetshDNS2Command = "netsh interface ip add dns name=" & """" & LANInterfaceName & """" & " addr=" & strDNS2
strNetshWins1Command = "netsh interface ip set wins name=" & """" & LANInterfaceName & """" & " source=static addr=" & strWINS1
strNetshWins2Command = "netsh interface ip add wins name=" & """" & LANInterfaceName & """" & " addr=" & strWINS2
Set oShell = WScript.CreateObject("WScript.Shell")
oShell.Run(strNetshInterfaceCommand)
oShell.Run(strNetshDNS1Command)
oShell.Run(strNetshDNS2Command)
oShell.Run(strNetshWINS1Command)
oShell.run(strNetshWINS2Command)
Set oShell = Nothing
iCount = iCount + 1
Next
A me funziona; se qualcuno, per cortesia, può provare lo script, e rilevare eventuali problemi...