Jump to content

Adding Static IP to Interface using VBS


Recommended Posts

from my vb script, i need to add an ip address(+snmask) to an interface such as "local area connection" that already has several ip addresses assigned to it.

i have been searching and trying with wmi methods in the Win32_NetworkAdapter and Win32_NetworkAdapterConfiguration classes and it seems there is no method for *adding* an ip.

i would try to do it with registry (HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{GUID})

but i have no way of finding the guid of the interface.

thanks in advance for your help

Link to comment
Share on other sites


thank you gunsmokingman, but this article has only code to *get* the tcp/ip configuration. i need to modify it.

*update*

so here is what i have found out from countless hours searching web. it seems that you cannot add one ip address without removing and adding all addresses for that interface. so i have to use a script like the one gunsmokingman referenced above to read out the current ip's/snm's to an array and then add my ip address onto the end of that array and re-enter teh entire array using enableStatic().

the problem i am running into is adding my ip address to the array. i have tried several syntax and will not accept my array into enableStatic() function.

any help would be great because i really do not want to shell out and use netsh. its slow and cumbersome.

cheers

Edited by SimonSez07
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...