VB Script - easy I'm sure - TechRepublic
Question
July 15, 2009 at 02:39 AM
martin

VB Script – easy I’m sure

by martin . Updated 16 years, 11 months ago

Hi guys,

I need to have a script that prompts for an IP address to be entered and this then puts it in the field to change the IP. Currently I have to edit the script manually, save it then run it. The working code so far is:

strComputer = “.”
Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2”)

Set colNetAdapters = objWMIService.ExecQuery _
(“Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=True”)

strIPAddress = Array(“192.168.xxx.xxx”)
strSubnetMask = Array(“255.255.255.0”)

For Each objNetAdapter in colNetAdapters
errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
Next

I just want to have a user input box which prompts for the IP address and inputs this into the strIPAddress array.

Any clues? Sure its an easy one for a VB expert.

Thanks.

This discussion is locked

All Comments