R
RRohl
In this scrip file I am able to open a text file, ping the computer by
host name and return the hostname and status to a specified excel
workbook/sheet. Instead of calling a text file for the hostname I want
to call the hostname from a specified column in the worksheet and only
record the status. I would like this to execute once every 300
seconds. Any Ideas?
'Shell ("ping.exe -t " & ActiveCell.Value), vbNormalFocus
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objWorkbook = objExcel.Workbooks.Open("C:servers.xls")
Set objWorksheet = objWorkbook.Worksheets(4)
intRow = 2
objExcel.Cells(1, 1).Value = "Machine Name"
objExcel.Cells(1, 2).Value = "Results"
Set Fso = CreateObject("Scripting.FileSystemObject")
Set InputFile = fspenTextFile("MachineList.Txt")
Do While Not (InputFile.atEndOfStream)
HostName = InputFile.ReadLine
Set WshShell = WScript.CreateObject("WScript.Shell")
Ping = WshShell.Run("ping -n 1 " & HostName, 0, True)
objExcel.Cells(intRow, 1).Value = HostName
Select Case Ping
Case 0 objExcel.Cells(intRow, 2).Value = "On Line"
Case 1 objExcel.Cells(intRow, 2).Value = "NO PING"
End Select
intRow = intRow + 1
Loop
objExcel.Range("A1:B1").Select
objExcel.Selection.Interior.ColorIndex = 1
objExcel.Selection.Font.ColorIndex = 6
objExcel.Selection.Font.Bold = True
objExcel.Cells.EntireColumn.AutoFit
host name and return the hostname and status to a specified excel
workbook/sheet. Instead of calling a text file for the hostname I want
to call the hostname from a specified column in the worksheet and only
record the status. I would like this to execute once every 300
seconds. Any Ideas?
'Shell ("ping.exe -t " & ActiveCell.Value), vbNormalFocus
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objWorkbook = objExcel.Workbooks.Open("C:servers.xls")
Set objWorksheet = objWorkbook.Worksheets(4)
intRow = 2
objExcel.Cells(1, 1).Value = "Machine Name"
objExcel.Cells(1, 2).Value = "Results"
Set Fso = CreateObject("Scripting.FileSystemObject")
Set InputFile = fspenTextFile("MachineList.Txt")
Do While Not (InputFile.atEndOfStream)
HostName = InputFile.ReadLine
Set WshShell = WScript.CreateObject("WScript.Shell")
Ping = WshShell.Run("ping -n 1 " & HostName, 0, True)
objExcel.Cells(intRow, 1).Value = HostName
Select Case Ping
Case 0 objExcel.Cells(intRow, 2).Value = "On Line"
Case 1 objExcel.Cells(intRow, 2).Value = "NO PING"
End Select
intRow = intRow + 1
Loop
objExcel.Range("A1:B1").Select
objExcel.Selection.Interior.ColorIndex = 1
objExcel.Selection.Font.ColorIndex = 6
objExcel.Selection.Font.Bold = True
objExcel.Cells.EntireColumn.AutoFit