Setting static IP

  • Thread starter Thread starter Simon Wilton
  • Start date Start date
S

Simon Wilton

I've seen a lot of traffic on setting of static IP parameters in this group

Found something very simple that seems to work at

http://www.csparks.com/xml/ipchange/index.xml

I've got no connection to this, but offer the info for what its worth. I
also haven't worked out what I can remove from my build now I've got this
(netsh, etc).

Simon
 
Simon,
you can also script the ip.


copy-------
ask = inputbox("You are about to manualy configure your IP connections. If
you want to continue type 'yes'","B.E.T.I. Static IP")
if ask = "yes" then
IpADD = inputbox("If you would you like to set your IP manualy enter your
IP" & chr(10) & "The default is: 192.168.0.1","B.E.T.I. Static IP")
if IpADD = "" then
IpADD = "192.168.0.1"
end if
SubNet = inputbox("would you like to set your IP manualy enter your subnet"
& chr(10) & "The default is: 255.255.255.0","B.E.T.I. Static IP")
if SubNet = "" then
SubNet = "255.255.255.0"
end if
gat =inputbox("would you like to set your IP manualy enter your gateway" &
chr(10) & "The default is: blank","B.E.T.I. Static IP")
if gat = "" then
gat = ""
end if
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery("Select * from
Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
strIPAddress = Array(IpADD)
strSubnetMask = Array(SubNet)
strGateway = Array(gat)
strGatewayMetric = Array(1)
if IpADD <> "" and SubNet <> "" then
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 If
Next
end if
WScript.Echo errEnable
end if

copy--------
 
Back
Top