|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
IP Change Script fails
laptops that move from place to place. I used the following format for my script. However, it only works in one location and I get the warning 1005 listed below. 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 Event Type: Warning Event Source: Dhcp Event Category: None Event ID: 1005 Date: 10/17/2007 Time: 2:59:20 PM User: N/A Computer: ISSQNSOFFICE Description: Your computer has detected that the IP address 172.17.69.220 for the Network Card with network address 0013722B3E03 is already in use on the network. Your computer will automatically attempt to obtain a different address. For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp. |
|||||||||||||||||||||||