Hello friends,

i´m Eduardo Martin(Spain).

I´m developing a script to put several ip addresses to a network device.
Using as template the scipt to put a ip address of technet script repository
i´m able to put only one ip, and i have tryed to find in WMI library, play
with arrays, etc... without results.

Can anyone help me , or give me a clue ??

Thanks in advanced

Re: Several IP addresses script by Ulf

Ulf
Sat Oct 30 13:18:13 CDT 2004

Hi Eduardo,

I think you're looking for this wmi method/class
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/enablestatic_method_in_class_win32_networkadapterconfiguration.asp
Use as the first parameter an array with ip addresses and you should be able
to configure multiple addresses.

ulf

Eduardo Martin wrote:
> I´m developing a script to put several ip addresses to a network
> device. Using as template the scipt to put a ip address of technet



Re: Several IP addresses script by Eduardo

Eduardo
Sat Oct 30 13:30:02 CDT 2004

Thanks for your reply.

I was viewing this page, but, i´m so stupid to understand what is the
correct sintaxis

i´have tred to do
strIPAddress = Array("192.168.1.141")
strIPAddress2 = Array("192.168.1.142")
errEnable = objNetAdapter.EnableStatic([strIPAddress, strIPAddress2],
strSubnetMask)

and also i have tried to do
strIPAddress = Array("192.168.1.141","192.168.1.142")
errEnable = objNetAdapter.EnableStatic([strIPAddress, strSubnetMask)

Without results :-(((((

Can you give me the last help,

Thank you very much

"Ulf Dornheck Busscher" wrote:

> Hi Eduardo,
>
> I think you're looking for this wmi method/class
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/enablestatic_method_in_class_win32_networkadapterconfiguration.asp
> Use as the first parameter an array with ip addresses and you should be able
> to configure multiple addresses.
>
> ulf
>
> Eduardo Martin wrote:
> > I´m developing a script to put several ip addresses to a network
> > device. Using as template the scipt to put a ip address of technet
>
>
>

Re: Several IP addresses script by Ulf

Ulf
Sat Oct 30 14:35:19 CDT 2004

Hi Eduardo,

You will have to set .DHCPEnabled to false.
This sample code works:

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
'add a where statement to the wmi query in the next line to select the
adapter you want to configure
Set colItems = objWMIService.ExecQuery("Select * from
Win32_NetworkAdapterConfiguration")
For Each objItem In colItems
objitem.DHCPEnabled = False
objitem.enablestatic(array("192.168.222.173","10.0.0.1",
array("255.255.255.0","255.0.0.0"))
Next

If you need further help feel free to ask.

Regards

Ulf

Eduardo Martin wrote:
> Thanks for your reply.
>
> I was viewing this page, but, i´m so stupid to understand what is the
> correct sintaxis
>
> i´have tred to do
> strIPAddress = Array("192.168.1.141")
> strIPAddress2 = Array("192.168.1.142")
> errEnable = objNetAdapter.EnableStatic([strIPAddress, strIPAddress2],
> strSubnetMask)
>
> and also i have tried to do
> strIPAddress = Array("192.168.1.141","192.168.1.142")
> errEnable = objNetAdapter.EnableStatic([strIPAddress, strSubnetMask)
>
> Without results :-(((((
>
> Can you give me the last help,
>
> Thank you very much
>
> "Ulf Dornheck Busscher" wrote:
>
>> Hi Eduardo,
>>
>> I think you're looking for this wmi method/class
>>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/enablestatic_method_in_class_win32_networkadapterconfiguration.asp
>> Use as the first parameter an array with ip addresses and you should
>> be able to configure multiple addresses.
>>
>> ulf
>>
>> Eduardo Martin wrote:
>>> I´m developing a script to put several ip addresses to a network
>>> device. Using as template the scipt to put a ip address of technet