System Check

System Check

Solution: Used a simple VB code which uses ping command of c prompt and checks if all the systems are on or off then it would shoot a email to the systems which are online ( active ).
we have to give the ip address of all the systems on floor as the input and we can get the output of the status in an excel sheet or a notepad.then it shoots an email to the spoc (single point of contact) and the person who’s system is on via outlook.
sample code:

dim strInputPath, strOutputPath, strStatus
dim objFSO, objTextIn, objTextOut

strInputPath = "c:\serverlist.txt" '- location of input
strOutputPath = "c:\output.txt" '- location of output

set objFSO = CreateObject("Scripting.FileSystemObject")
set objTextIn = objFSO.OpenTextFile( strInputPath,1 )
set objTextOut = objFSO.CreateTextFile( strOutputPath )
objTextOut.WriteLine("computer,status")

Do until objTextIn.AtEndOfStream = True
strComputer = objTextIn.ReadLine
if fPingTest( strComputer ) then
strStatus = "On"
else
strStatus = "Off"
end if
objTextOut.WriteLine(strComputer & "," & strStatus)
loop

function fPingTest( strComputer )
dim objShell,objPing
dim strPingOut, flag
set objShell = CreateObject("Wscript.Shell")
set objPing = objShell.Exec("ping " & strComputer)
strPingOut = objPing.StdOut.ReadAll
if instr(LCase(strPingOut), "reply") then
flag = TRUE
else
flag = FALSE
end if
fPingTest = flag

end function

Taggings:

Subscribe to System Check