Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remote IP Change

Status
Not open for further replies.

dbustamante

IS-IT--Management
Jul 12, 2010
63
US
ok guys do any of you know how to change an IP and DNS via CMD?. i have a CMD that can change it for the local PC but i need to do it for about 40+ computers. Any ideas?

Heres what i have so far...

netsh interface ip set address name="Local Area Connection" source=static addr=111.222.333.444 mask=111.222.333.444
netsh interface ip set address name="Local Area Connection" gateway=111.222.333.444 gwmetric=0
netsh interface ip set dns name="Local Area Connection" source=static addr=111.222.333.444
netsh interface ip add dns name = "Local Area Connection" addr = 111.222.333.444
 
netsh -r \\name .........
or
netsh -r ip-adress ..........

M. Knorr

MCSE, MCTS, MCSA, CCNA
 
ok i tried both ways and i got a "warning: could not obtain host information from machine: [ip]. some commands may not be available. the RPC server is unavailable. should i put something like

dim net

netsh -r ip-adress interface 10.37.224.200 interface ip set address name="Local Area Connection" source=static addr=10.37.224.74 mask=255.255.224.0
netsh -r ip-adress interface 10.37.224.200 interface ip set address name="Local Area Connection" gateway=10.37.224.1 gwmetric=0
netsh -r ip-adress interface 10.37.224.200 interface ip set dns name="Local Area Connection" source=static addr=10.37.224.10
netsh -r ip-adress interface 10.37.224.200 interface ip add dns name = "Local Area Connection" addr = 10.151.2.52
 
ok my bad scratch that last one entry i think it should look something more like this

netsh -r 10.37.224.200 interface ip set address name="Local Area Connection" source=static addr=10.37.224.216 mask=255.255.224.0
netsh -r 10.37.224.200 interface ip set address name="Local Area Connection" gateway=10.37.224.1 gwmetric=0
netsh -r 10.37.224.200 interface ip set dns name="Local Area Connection" source=static addr=10.37.224.10
netsh -r 10.37.224.200 interface ip add dns name = "Local Area Connection" addr = 10.151.2.52

but i still error out so im messing up somewhere.
 
I've used Netsh to change things like DNS settings but never been brave enough to try IP addresses.

One tip - it would be sensible to add the new address as a secondary and establish connectivity on that address before removing the original. That may also give the RPC server something to hang on to, it may be failing because removing the ip (to put another on) confuses the network services like RPC

 
ok so what your saying is i should do something like this

code]
netsh -r 10.37.224.200 interface ip address name="Local Area Connection" source=static addr=10.37.224.200
Red netsh -r 10.37.224.200 interface ip set address name ="Local Area Connection" source=static addre=10.37.224.216
mask=255.255.224.0
netsh -r 10.37.224.200 interface ip set address name="Local Area Connection" gateway=10.37.224.1 gwmetric=0
netsh -r 10.37.224.200 interface ip set dns name="Local Area Connection" source=static addr=10.37.224.10
netsh -r 10.37.224.200 interface ip add dns name = "Local Area Connection" addr = 10.151.2.52
Code:
 
lol wow that did not come out at all how i wanted it to hold on let me fix it.

ok so what your saying is i should do something like this

Code:
netsh -r 10.37.224.200 interface ip address name="Local Area Connection" source=static addr=10.37.224.200 mask=255.255.224.0
[COLOR=#ff0000]netsh -r 10.37.224.200 interface ip set address name ="Local Area Connection" source=static addre=10.37.224.216 mask=255.255.224.0[/color]
netsh -r 10.37.224.200 interface ip set address name="Local Area Connection" gateway=10.37.224.1 gwmetric=0
netsh -r 10.37.224.200 interface ip set dns name="Local Area Connection" source=static addr=10.37.224.10  
netsh -r 10.37.224.200 interface ip add dns name = "Local Area Connection" addr = 10.151.2.52
 
Well I thought so - but having had a quick try this end - I'm not so sure.

The theory would be add the 224.216 address then use that 224.216 address as the -r machine to then remove the 224.200 - however I can't get those commands to work remotely - I'll have a quick fiddle...
 
Having had a play - on the local netsh I can use interface ip add address "Local Area Connection" i.i.i.i m.m.m.m to add an address and then delete it but it seems those commands are not available to me in netsh -r - even going through manually. I suspect netsh is preventing it to stop loss of service.
Not sure where you should go next - perhaps someone has a better idea but maybe a logon script so it runs locally? Or set up a DHCP server and set reservations (still need to get the cards to go to DHCP then though)

Sorry for leading you astray!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top