I want a GUI tool that will read in a text file of hostnames and resolve the hostnames to IP addresses and then ping them. The end result should be some sort of table with the hostname, IP address and the ping result (which could be just "No response" or "Response Rec'd" or similar). Does anyone have any suggestions? Or have any code? The tool doesn't have to be free, if you know of a program that does it that would be fine.
Example:
PC1 192.168.1.100 No response
PC2 192.168.1.102 Response received
PC3 192.168.1.103 Response received
'PingPCs.vbs
Dim objFSO: Set objFSO = CreateObject("Scripting.Fi
Dim objShell: Set objShell = CreateObject("Wscript.shel
Dim objExcell: Set objExcel = CreateObject("Excel.Applic
Dim objFile: Set objFile = objFSO.OpenTextFile("C:\PC
Dim objWS, iRow
strReport = "C:\Output.xls" 'Output report
'Create and setup worksheet
objExcel.DisplayAlerts = 0
objExcel.Workbooks.Add
Set objWS = objExcel.ActiveWorkbook.Wo
objWS.Name = "Ping Results"
Set Cells = objWS.Cells
With objWS
.Cells(1, 1).Value = "ComputerName"
.Cells(1, 2).Value = "IP Address"
.Cells(1, 3).Value = "Response"
.Range("A1:C1").Font.Bold = True
End With
iRow = 2
Do While Not objFile.AtEndOfStream
strData = objFile.ReadLine
Ping strData
Loop
objExcel.ActiveWorkbook.Sa
objExcel.Quit
'Cleanup
Set objShell = Nothing
Set objWS = Nothing
Set objExcel = Nothing
WScript.Quit
Sub Ping(strPC)
On Error Resume Next
Set objWMI = GetObject("winmgmts:{imper
Set colItems = objWMI.ExecQuery("Select * from Win32_PingStatus Where Address = '" & strPC & "'")
strStatusCode = 1
For Each objItem In colItems
With objWS
strStatusCode = objItem.StatusCode
.Cells(iRow, 1) = strPC
.Cells(iRow, 2) = objItem.ProtocolAddress
.Cells(iRow, 3) = IIf(strStatusCode = 0, "Response received", "No response")
iRow = iRow + 1
End With
Next
End Sub