Information Technology Reference
In-Depth Information
Using a Command-Line Interface
The following command configures a static IP, subnet mask, default gateway, and gateway
metric for the local area connection (change "Local Area Connection" to fit the name of a
particular connection):
> netsh interface ip set address "Local Area Connection"
static addr = <IP Address> mask = <Subnet Mask>
gateway = <Gateway IP> gwmetric = <Metric>
As an example, plugging actual numeric values into this syntax would produce something
like this:
> netsh interface ip set address "Local Area Connection"
static addr = 10.0.0.100 mask = 255.0.0.0 gateway = 10.0.0.1 gwmetric = 1
Using the Registry
To configure a static IP address for the interface represented by <Interface GUID> , set the
following Registry values:
[HKEY_LOCAL_MACHINE\SYSTEM\Current Control Set\
Services\Tcpip\Parameters\Interfaces\ {<Interface GUID>} ]
"IPAddress"=REG_MULTI_SZ:" <IP Address> "
[HKEY_LOCAL_MACHINE\SYSTEM\Current Control Set\Services\
Tcpip\Parameters\ Interfaces\ {<Interface GUID>} ]
"SubnetMask"=REG_MULTI_SZ:" <Subnet Mask> "
[HKEY_LOCAL_MACHINE\SYSTEM\Current Control Set\Services\
Tcpip\Parameters\ Interfaces\ {<Interface GUID>} ]
"DefaultGateway"=REG_MULTI_SZ:" <Default Gateway> "
Using VBScript
This code sets the local IP address to a static IP of 10.0.0.100 with a subnet mask of 255.0.0.0 ,
a default gateway of 10.0.0.1 , and a metric of 1 . Change these values as needed to fit your
environment.
' ------ SCRIPT CONFIGURATION ------
strComputer = "."
strIPAddress = Array("10.0.0.100")
strSubnetMask = Array("255.0.0.0")
strGateway = Array("10.0.0.1")
strGatewayMetric = Array(1)
' --------- END CONFIGURATION ------
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Search WWH ::




Custom Search