Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set adapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each a in adapters
errIP = a.EnableStatic(strIPAddress, strSubnetMask)
errGateways = a.SetGateways(strGateway, strGatewaymetric)
If errIP = 0 Then
WScript.Echo "Success! The IP address has been changed."
Else
WScript.Echo "Error! The IP address could not be changed."
End If
Next