Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Tips Database Forum Rss Feed

» Database Journal Home
» Database Articles
» Database Tutorials
MS Access
SQL Scripts & Samples
» Database Forum
» Slideshows
Free Newsletters:

News Via RSS Feed

Rss Feed

Database Journal |DBA Support |SQLCourse |SQLCourse2

Featured Database Articles


Posted Mar 2, 2005

Checking the status of weekly rebooted SQL Servers - Page 2

By Muthusamy Anantha Kumar aka The MAK

Step 6

Create c:\checkreboot\sendsmtp.vbs and copy and paste the code below into it. [Refer Fig 1.5]

'Send SMTP Email
'Created by : MAK
'Contact: mak_999@yahoo.com


Const ForReading = 1 
Const ForWriting = 2 

Set fso = CreateObject

Set ReadFile = fso.OpenTextFile
 (VFilename, ForReading, TristateFalse) 
thisTXT = ReadFile.ReadAll 

Set objMessage = 
objMessage.Subject = VSubject
objMessage.Sender = VEmail
objMessage.To = VEmail
objMessage.TextBody = thisTXT
'msgbox y
'The line below shows how to send 
'a webpage from a remote site 
objMessage.Configuration.Fields.Item _ 
 configuration/sendusing") = 2 
'Name or IP of Remote SMTP Server 
objMessage.Configuration.Fields.Item _ 
 configuration/smtpserver") = 
'Server port (typically 25) 
objMessage.Configuration.Fields.Item _ 
 configuration/smtpserverport") = 25 


Fig 1.5

Download sendsmtp.vbs_

Note: Please change the SMTP server name to your SMTP server name.

Step 7

Execute the CheckReboot.bat file as shown below. [Refer Fig 1.6]

Fig 1.6

Once you execute this batch file, it checks the status of all of the listed servers and sends two emails. One email will have all of the servers that were not successfully rebooted along with corresponding error messages [Refer Fig 1.7] and another email will have a list of the servers that were successfully rebooted with the proper server name and version. [Refer Fig 1.8]

Fig 1.7

Fig 1.8

If the reboot cycle is around 1AM, schedule this "checkreboot.bat" to be scheduled for 2AM.


This article examined how to get the status of all the rebooted servers on the network.

» See All Articles by Columnist MAK

MS SQL Archives

Latest Forum Threads
MS SQL Forum
Topic By Replies Updated
SQL 2005: SSIS: Error using SQL Server credentials poverty 3 August 17th, 07:43 AM
Need help changing table contents nkawtg 1 August 17th, 03:02 AM
SQL Server Memory confifuration bhosalenarayan 2 August 14th, 05:33 AM
SQL Server Primary Key and a Unique Key katty.jonh 2 July 25th, 10:36 AM