1.

Solve : How do you change Static IP for Windows XP Pro from Command Shell???

Answer»

Hello,

I am trying to find a way to change my servers static ip from the command shell of windows xp... Its easy in the gui to do this, but the command will be added to a batch routine, so it has to happen from the command shell.

This is probably simple, but I FORGOT the tool and command switches etc.

Thanksyou can TRY this vbscript
Code: [Select]strIPAddress = Array("10.0.1.101")
strSubnetMask = Array("255.0.0.0")
strGateway = Array("10.0.1.1")
strGatewayMetric = Array(1)
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set adapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each ADAPTER in adapters
errIP = adapter.EnableStatic(strIPAddress, strSubnetMask)
errGateways = adapter.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
or you can USE the netsh tool, eg
Code: [Select]netsh interface ip set address "Local Area CONNECTION" static 192.168.0.50 255.255.255.0



Discussion

No Comment Found