Loading |
VBScript |
JavaScript |
Powershell |
Search Options: Assign a Static IP AddressContent of Assign a Static IP Address.vbsMD5 Hash: 206ACC43715537721B9AAE811280D389 |
||
' Description: Sets the IP address of a computer to 192.168.1.141, and sets the IP gateway to 192.168.1.100.
strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colNetAdapters = objWMIService.ExecQuery _ ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE") strIPAddress = Array("192.168.1.141") strSubnetMask = Array("255.255.255.0") strGateway = Array("192.168.1.100") strGatewayMetric = Array(1) 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 | ||
© 2008 - 2013 Boris Toll :: Scripts available: 6.481 :: :: scriptbox.toll.at :: :: powered by www.toll.at :: |