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
VEmail=WScript.Arguments(0)
VFilename=WScript.Arguments(1)
VSubject=WScript.Arguments(2)
Const ForReading = 1
Const ForWriting = 2
Set fso = CreateObject
("Scripting.FileSystemObject")
Set ReadFile = fso.OpenTextFile
(VFilename, ForReading, TristateFalse)
thisTXT = ReadFile.ReadAll
Set objMessage =
CreateObject("CDO.Message")
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 _
("http://schemas.microsoft.com/cdo/
configuration/sendusing") = 2
'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/
configuration/smtpserver") =
"optonline.net"
'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/
configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
objMessage.Send
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.
Conclusion
This article examined how to get the status of all the
rebooted servers on the network.
»
See All Articles by Columnist MAK