一个查看局域网在线IP的vbs脚本
一个查看局域网在线IP的vbs脚本
发布时间:2016-12-28 来源:查字典编辑
摘要:复制代码代码如下:strSubNet="192.168.1."SetobjFSO=CreateObject("Scripting.FileS...

复制代码 代码如下:

strSubNet = "192.168.1."

Set objFSO= CreateObject("Scripting.FileSystemObject")

Set objTS = objfso.CreateTextFile("e:PingResult.txt")

For i = 1 To 254

strComputer = strSubNet & i

blnResult = Ping(strComputer)

If blnResult = True Then

objTS.WriteLine "Ping " & strComputer & " success!"

End If

Next

objTS.Close

WScript.Echo "Done!"

Function Ping(strComputer)

Set objWMIService = GetObject("winmgmts:.rootcimv2")

Set colItems = objWMIService.ExecQuery("Select * From Win32_PingStatus Where Address='" & strComputer & "'")

For Each objItem In colItems

Select case objItem.StatusCode

Case 0

Ping = True

Case Else

Ping = False

End select

Exit For

Next

End Function

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新vbs学习
热门vbs学习
脚本专栏子分类