'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'批量检查指定服务器是否正常(除过滤icmp包的服务器)
'坏男孩版权所有
'QQ:383088680
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
On Error Resume Next
Dim FSO
Dim FilePath
Dim objPing
Dim objFile
Dim AllCont
Dim ColCont
Dim i
Dim ShowCont
ShowCont="哈哈朱温馨提醒:"+vbcrlf+vbTab+"请写出绝对路径(保证存在),而且是文本文件(如 c:\ip.txt),"+vbCRLF+"否则将不给予任何信息显示!"
Wscript.Echo ShowCont
FilePath=InputBox("请输入您要读取的文本文件内容的绝对路径!")'注意我们只接收文本文件,既.txt结尾
If Trim(FilePath)<>"" then
Set Fso=CreateObject("Scripting.FileSystemObject")
Set objFile=Fso.openTextFile(FilePath,1,True)
if Fso.GetExtensionName(FilePath)<>"txt" then
wscript.quit()
end if
AllCont=objFile.ReadAll
ColCont=Split(Trim(AllCont),",")
For i=0 to ubound(ColCont)
Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}")._
ExecQuery("select * from Win32_PingStatus where address = '"_
&ColCont(i)& "'")
For Each objStatus in objPing
If IsNull(objStatus.StatusCode) or objStatus.StatusCode<>0 Then
WScript.Echo("温馨提示: " & ColCont(i) & " 不能PING通啊!")
End If
Next
Next
wscript.quit()
Else
Wscript.Echo "你放弃了批量处理PING功能啊!"
Wscript.Quit()
'批量检查指定服务器是否正常(除过滤icmp包的服务器)
'坏男孩版权所有
'QQ:383088680
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
On Error Resume Next
Dim FSO
Dim FilePath
Dim objPing
Dim objFile
Dim AllCont
Dim ColCont
Dim i
Dim ShowCont
ShowCont="哈哈朱温馨提醒:"+vbcrlf+vbTab+"请写出绝对路径(保证存在),而且是文本文件(如 c:\ip.txt),"+vbCRLF+"否则将不给予任何信息显示!"
Wscript.Echo ShowCont
FilePath=InputBox("请输入您要读取的文本文件内容的绝对路径!")'注意我们只接收文本文件,既.txt结尾
If Trim(FilePath)<>"" then
Set Fso=CreateObject("Scripting.FileSystemObject")
Set objFile=Fso.openTextFile(FilePath,1,True)
if Fso.GetExtensionName(FilePath)<>"txt" then
wscript.quit()
end if
AllCont=objFile.ReadAll
ColCont=Split(Trim(AllCont),",")
For i=0 to ubound(ColCont)
Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}")._
ExecQuery("select * from Win32_PingStatus where address = '"_
&ColCont(i)& "'")
For Each objStatus in objPing
If IsNull(objStatus.StatusCode) or objStatus.StatusCode<>0 Then
WScript.Echo("温馨提示: " & ColCont(i) & " 不能PING通啊!")
End If
Next
Next
wscript.quit()
Else
Wscript.Echo "你放弃了批量处理PING功能啊!"
Wscript.Quit()
End if
本文转自hahazhu0634 51CTO博客,原文链接:http://blog.51cto.com/5ydycm/162863,如需转载请自行联系原作者