Jump to content

stak1993

Member
  • Posts

    2
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    Afghanistan

About stak1993

Profile Information

  • OS
    Windows 7 x64

stak1993's Achievements

0

Reputation

  1. Yzowl, Thanks I will look at Powershell and the other post. Thanks! gunsmokingman, I have been messing with HTA and I like the way it works. So I may lean in that direction, any help would be great. Scott
  2. Hello, I am new to the forums as a poster, I have utilized code from here before and it has always been great. So I have a question, I got this code form this forum and it works great. I want to make a GUI instead of the text file for results and make it ping in a loop until I stop it. Any ideas or other posts you can point me to would be great. Thank you again for all of the time you spend helping us less intelligent. Scott Option Explicit Const ForReading = 1, ForWrite = 2, ForAppend = 8' Oblects And Varibles Dim Act :Set Act = CreateObject("Wscript.Shell") Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject") Dim Wmi :Set Wmi = GetObject("winmgmts:\\.\root\cimv2") Dim i, Obj, strText, Results1,Results2, Ts'-> Check For Servers.txt If Fso.FileExists(Fso.GetParentFolderName(WScript.ScriptFullName) & "\servers.txt") Then'-> Process The Text File With The Server Information Set Ts = Fso.OpenTextFile("servers.txt", ForReading) strText = Ts.ReadAll Ts.Close'-> Loop One Process The Servers.txt For Each i In Split(strText, vbCrLf)'-> Loop To Ping Each Server From Servers Text For Each Obj in Wmi.ExecQuery("Select * From Win32_PingStatus where Address = '" & i & "'") If IsNull(Obj.StatusCode) Or Obj.StatusCode <> 0 Then Results2 = Results2 & " Computer Off Line : " & i & vbCrLf Else Results1 = Results1 & " Computer On Line : " & i & vbCrLf End If Next Next '-> Create The Results Text File Set Ts = Fso.CreateTextFile("results.txt") Ts.WriteLine "Ping From Server.txt Results" & vbCrLf & " Date And Time : " & Now & Vbcrlf Ts.WriteLine Results1 Ts.WriteLine Results2 Ts.Close() Act.Run("notepad.exe " & Chr(34) & "results.txt" & Chr(34)),1,True Else MsgBox vbTab & "Error" & vbcrlf &_ "Missing, the server.txt to process. You" & vbCrLf & _ "must create a servers.txt with an IP or" & vbCrLf & _ "Computer Name, with one per line",4128,"Error" End If
×
×
  • Create New...