|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hello, I Have the following script to change the ip address to multiple
computers strComputer = "." strComputer1 = "computer2" 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 I |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
"gustavo" <gustavo@discussions.microsoft.com> wrote in message
news:ACF29C7E-3227-486C-BAE3-9A84B074C555@microsoft.com... > Hello, I Have the following script to change the ip address to multiple > computers > > strComputer = "." > strComputer1 = "computer2" > 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 I I assume that, in the process of truncating your script, the usenet goblins stripped your question off the end. Please re-post. /Al |
|
![]() |
| Outils de la discussion | |
|
|