Click here to Skip to main content
15,885,244 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a list of 30 servers with its scheduled re-boot time in an excel file. I just want to check whether the servers are up after its scheduled re-boot using vb script and mail me the status after checking each server.
Posted
Comments
PIEBALDconsult 27-Sep-15 20:05pm    
Better to have each server send a heartbeat to the monitoring system on a schedule, perhaps hourly.
Garth J Lancaster 27-Sep-15 21:46pm    
a much better answer yes. I remember monitoring tools with dashboards for this, eg stuff from SolarWinds, Nagios etc, but the OP didn't give any indication of $$ to spend. Some monitoring systems Ive seen expect you to write the tests for them in (script) and I think 'whats the point'

1 solution

Add a column to your script with the tcp/ip address of each server and do a ping perhaps ?

Something like this will get you started on the ping bit itself - do a google for 'vbscript smtp mail' and Im sure you'll find plenty of code for emailing yourself

VB
'==========================================================================
' The following function will test if a machine is reachable via a ping
' using WMI and the Win32_PingStatus Class
'==========================================================================
If Reachable("10.50.138.48") Then
 WScript.Echo "Computer is Reachable!"
Else
 WScript.Echo "Computer is Unreachable!"
End If

Function Reachable(strComputer)
'     On Error Resume Next

 Dim wmiQuery, objWMIService, objPing, objStatus

 wmiQuery = "Select * From Win32_PingStatus Where Address = '" & strComputer & "'"

 Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
 Set objPing = objWMIService.ExecQuery(wmiQuery)

 For Each objStatus in objPing
     If IsNull(objStatus.StatusCode) Or objStatus.Statuscode<>0 Then
         Reachable = False 'if computer is unreacable, return false
     Else
         Reachable = True 'if computer is reachable, return true
     End If
 Next
End Function




ref :
http://www.visualbasicscript.com/Ping-WMI-amp-NonWMI-Versions-Functions-amp-Simple-Connectivity-Monitor-m42535.aspx[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900