当前位置: 移动技术网 > IT编程>网络>Dos/Bat > 远程批量修改计算机IP设置的批处理

远程批量修改计算机IP设置的批处理

2017年12月08日  | 移动技术网IT编程  | 我要评论
网络ip设置远处更改脚本。

当网络整改需要大量ip修改的时候,可利用该脚本进行更改(重启计算机前不生效,可继续工作),然后等下班时间修改交换机配置,次日所有计算机启动后就可以用新ip工作了。

前提条件,知道域管理员密码或者所有计算机的本机管理员密码(后者比较麻烦),客户计算机为win2k或xp(防火墙开放135~139端口)。

一条命令批量修改:
for /l %i in (2,1,254) do net use //192.168.0.%i /user:admin@domain.com "password" && setipconfig 192.168.0.%i 10.0.0.%%i 255.255.255.0 10.0.0.1

setipconfig.bat内容如下:
复制代码 代码如下:

@echo off
echo %4 | find "echo" >nul && echo usage: setipconfig remoteip newip newsubnet newgateway && goto :end
sc //%1 query remoteregistry | find "running" || (sc //%1 config remoteregistry start= demand && sc //%1 start remoteregistry)

:loop
sc //%1 query remoteregistry | find "running" && goto begin
ping 127.0.0.1 -n 3 >null
goto loop


goto end

:begin
for /f %%i in ('reg query //%1/hkey_local_machine/system/currentcontrolset/services/tcpip/parameters/interfaces ^| find "{"') do (
reg query //%1/%%i /v ipaddress | find "%1" && (
reg add //%1/%%i /v ipaddress /t reg_multi_sz /d %2 /f ) && (
reg add //%1/%%i /v subnetmask /t reg_multi_sz /d %3 /f ) && (
reg add //%1/%%i /v defaultgateway /t reg_multi_sz /d %4 /f )


:end

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网