|
'Change IP to say
The following script is saved as a *.vbs file, and you can change the IP, subnet mask, and gateway by double-clicking it.
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\"&strComputer&"\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=True")
strIPAddress = Array("192.168.0.12")
strSubnetMask = Array("255.255.255.0")
arrDefaultGateways = Array("192.168.0.1")
arrGatewayCostMetrics = Array(1)
For Each objNetAdapter in colNetAdapters
errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
errEnable = objNetAdapter.SetGateways(arrDefaultGateways, arrGatewayCostMetrics)
Next
WScript.Echo "Static IP address already enabled." |
|