This vbscript pings machines from a text file:
change the two variables for your input and output txt files:
strPATHout = “C:pingstatus.txt”
strPATHin = “C:pinglist.txt”
ON ERROR Resume Next 'Define log paths (disable in portions if not using a reference file) strPATHout = "C:#activepingstatus.txt" strPATHin = "C:#activepinglist.txt" 'Define additional variables here sMsgboxtxt = "ping?" 'message box text here sMsgboxttl = "ping?" 'message box title here sLogTitle = "ping?" 'log file title string 'Standard message stating whether you want to do this or not intReturn = Msgbox(sMsgboxtxt, vbYesNo, sMsgboxttl) If intReturn = vbNo Then Wscript.echo "Quitting" WScript.quit End If 'Create filesystem objects (comment out OBJin if not using reference file) Set OBJfs = CreateObject("Scripting.FileSystemObject") Set OBJin = OBJfs.OpenTextFile(strPATHin) Set OBJout = OBJfs.CreateTextFile(strPATHout,True) OBJout.WriteLine(sLogTitle & " - " & Now) Do Until OBJin.AtEndOfStream strComputer = lcase(OBJin.Readline) pingstatus = Ping(strComputer) OBJout.WriteLine(strComputer & "," & pingstatus) wscript.echo strComputer & "," & pingstatus Loop function Ping(sComputer) dim objShell, objPing, strPingOut, flag set objShell = CreateObject("Wscript.Shell") set objPing = objShell.Exec("ping -n 3 -w 1000 "& sComputer) strPingOut = objPing.StdOut.ReadAll if instr(LCase(strPingOut), "reply") then flag = TRUE if instr(LCase(strPingOut), "destination host unreachable") then flag = FALSE end if else flag = FALSE end if Ping = flag end function 'close the file OBJout.Close() OBJin.Close() Wscript.echo "Quitting" ' Quit the Script ---------------------------------------------------- WScript.quit
This is a quick one, it's been forever since I've posted here. After moving back…
Simple command turned crazy. I ended up coming up with this due to the fact…
Phew, this one took a minute to figure out. ConnectWise has a form based documents…
I've found myself at a new job, recreating many of the processes that I spent…
Wow, it's been a while since I've done a real post on this site. I've…
When using AutoTask's API it's required to lookup a various amount of picklist values that…