Afficher un message
Vieux 21/09/2007, 22h02   #1
gustavo
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut change the ip address to multiple computers

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
  Réponse avec citation
 
Page generated in 0,04863 seconds with 9 queries