As SysAdmins we need to monitor constantly our servers and it's services and the minimum action required to do it's to receive an email informing about issues. I will share with you a VBScript which can be used to perform this task (inform), you will only need an SMTP Server.
Most times to perform this kind of tasks you will need to buy a third party component, with this VBScript you can save some money. This VBScript works on Windows and you can use it as a complement for a BATCH file which monitors some Server or some Windows service.
Set objMessage = CreateObject("CDO.Message")
'==The following line shows the Subject
objMessage.Subject = "Monitoring"
'==The next line shows FROM, here most times in order to SMTP permits relay, you will need to use the same domain as the TO, even when the user does not exists (i.e. monitor)
objMessage.From = "monitor@company.com"
'==On the next line you will configure the target email.
objMessage.To = "myuser@company.com"
'==Now on the next line you can inform more in deep about the issue.
objMessage.TextBody = "Monitoring Message"
'==This section provides the configuration information for the remote SMTP server.
'==Normally you will only change the server name or IP.
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") = "smtp.mycompany.com"
'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587
objMessage.Configuration.Fields.Update
'==End remote SMTP server configuration section==
objMessage.Send
0 comentarios:
Post a Comment