How about
:
strComputer = "."Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")Set colNetAdapters = objWMIService.ExecQuery _ ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")strIPAddress = Array("192.168.1.141")strSubnetMask = Array("255.255.255.0")strGateway = Array("192.168.1.100")strGatewayMetric = Array(1) For Each objNetAdapter in colNetAdapters errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask) errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric) If errEnable = 0 Then WScript.Echo "The IP address has been changed." Else WScript.Echo "The IP address could not be changed." End IfNext
Check:
http://www.microsoft.com/technet/scr...r/default.mspx for almost everything under scripting.
Hope this helps.
--
Always try the MS KB first before posting.
MS KB:
http://support.microsoft.com/default...;EN-US;KBHOWTO
And the answer could have already been posted, so try searching this and other newsgroups first.
----
Mark-Allen Perry
ALPHA Systems
Marly, Switzerland
mark-allen_AT_mvps_DOT_org
"KennyB" <(E-Mail Removed)> wrote in message news:9BAEA2EC-9B4A-4E84-861F-(E-Mail Removed)...
I need to change the ip address on an adapter programmatically but the only
way i can figure out how to do it is to modify the ip address in the
registry, disable the network adapter, and then reenable it. Does anyone know
how I might do that? I've searched MSDN and CodeGuru among other places, and
there are lots of hints on adding an ip address, but none on deleting or
modifying it.
Thanks.....kennyb