ping 计算机
vbscript吧
全部回复
仅看楼主
level 2
276542471 楼主
strMachines = "atl-dc-01;atl-win2k-01;atl-nt4-01;atl-dc-02"aMachines = split(strMachines, ";")For Each machine in aMachines Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}")._ ExecQuery("select * from Win32_PingStatus where address = '"_ & machine & "'") For Each objStatus in objPing If IsNull(objStatus.StatusCode) or objStatus.StatusCode<>0 Then WScript.Echo("machine " & machine & " is not reachable") End If NextNext
2005年12月31日 19点12分 1
level 2
276542471 楼主
'strMachines = "192.168.1.1;202.103.44.5"'aMachines = split(strMachines, ";")'For Each machine in aMachinesFor i= 1 to 100 machine="192.168.1." & i Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}")._ ExecQuery("select * from Win32_PingStatus where address = '"_ & machine & "'") For Each objStatus in objPing If IsNull(objStatus.StatusCode) or objStatus.StatusCode<>0 Then 'msgbox "连接" & machine & "失败",48,""str=str & "连接" & machine & "失败" & vbcrlf Elsestr=str & "连接" & machine & "失败" & vbcrlf End If NextNextset fso=createobject("scripting.filesystemobject")set file1=fso.opentextfile("d:\ping.txt",8,true)file1.write strmsgbox "ok"
2005年12月31日 20点12分 2
level 0
不错!
2007年09月14日 01点09分 3
1