windows – 按名称批量文件到网络上的MASS ping计算机组,检查回
所以,我的
Windows Active Directory网络上有5000台计算机的列表,可能存在也可能不存在(我知道,不要问……我需要知道一个项目,当然,网络人员的帮助很少,他们给我的数据中有很多错误)
计算机名称属于SAT1至SAT5000. 我想知道是否有人可能有一个脚本,给定一个包含计算机名列表的文本文件,每个脚本: (甚至更好……是否有可能以某种方式将初始文件拆分为多个文件,并生成多个批处理文件以同时运行,以降低同步ping 5000台机器的速度?) 更新 这篇文章似乎与我正在寻找的有些相关: 更新2 这就是我最终的结果: @echo off rem del output.txt rem Loop thru list of computer names in file specified on command-line for /f %%i in (%1) do call :check_machine %%i goto end :check_machine rem Check to see if machine is up. echo %1 ping -n 2 %1 >NUL 2>NUL if errorlevel 1 goto down rem Reverse-lookup machine name and report for /f "usebackq tokens=2,3" %%d in (`ping -n 1 -a %1 ^| find "Pinging "`) do echo %1,%%d,%%e >> output.txt goto end :down rem Report machine down echo %1 >> output.txt :end 输出采用以下格式: SAT10 SAT1209 SAT601,CGY2601.na.sat.com,[110.3.111.70] SAT3592,CGY3592.na.sat.com,[110.0.237.45] 如果将计算机列表拆分为mutliple较小的文件,则可以异步ping,如下所示: del output.txt start MassPing.cmd Computers1.txt start MassPing.cmd Computers2.txt start MassPing.cmd Computers3.txt start MassPing.cmd Computers4.txt start MassPing.cmd Computers5.txt start MassPing.cmd Computers6.txt
这是一个批处理文件:
@echo off rem Loop thru list of computer names specified on command-line for /f %%i in (%1) do call :check_machine %%i goto end :check_machine rem Check to see if machine is up. ping -n 2 %1 >NUL 2>NUL if errorlevel 1 goto down rem Reverse-lookup machine name and report for /f "usebackq tokens=2" %%d in (`ping -n 1 -a %1 ^| find "Pinging"`) do echo %1:Up:%%d goto end :down rem Report machine down echo %1:Down :end 将一个包含计算机名称列表的文本文件传递给它,然后将它们PING它们(2次尝试 – 你可以通过增加第一个PING命令行中“-n”之后的数字来增加它),如果它得到了响应,执行名称的反向查找.它将结果返回为: computer-name-1:Up:name-it-resolved-to computer-name-2:Down computer-name-3:Up:name-it-resolved-to ... 要并行运行多个,只需创建具有不同机器名列表的多个文本文件,并并行启动几个副本. 快速和肮脏节省了一天. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- windows – 网络打印机离线(但不是真的)
- windows中的/ dev / zero等价?
- Microsoft Exchange Audit Logging
- windows – 将.exe包装到MSI中的最佳(免费)工具是什么?
- Microsoft DirectX DirectShow指针验证远程代码执行漏洞(M
- 在Windows 2012中为每分钟安排一个任务
- 如何防止Windows Server 2003修剪进程的工作集?
- Windows – 批处理文件 – 使用ping测试网络连接
- windows-phone-7 – 如何使用WebClient和Windows Phone 7禁
- 如何在Windows上为C中的访问冲突错误安装信号处理程序?