向局域网内所有计算机添加辅助DNS

添加DNS命令:

netsh interface ip add dns "local area connection" 100.100.11.1
 
远程命令:
psexec \\pcxxx -u global\xxxx -p ppppp netsh interface ip add dns "local area connection" 100.100.11.1 
 
bat文件(需要准备computername.txt)
for /f "tokens=1" %%a in (c:\temp\computername.txt) do (psexec \\%%a -u global\username -p password netsh interface ip add dns "local area connection" 100.100.11.1)
 
运行结果:
PsExec v1.98 - Execute processes remotely
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com
 
Starting netsh on pcxxx...e on pcxxx...
netsh exited on pcxxx with error code 0.

本文出自 “Johnny” 博客,转载请与作者联系!

你可能感兴趣的:(职场,计算机,命令行,局域网,休闲)