Did it work for you? Worked for me from home and on an XP machine at work but not from a win2K Adv server machine at work. Didn't have time to troubleshoot it today, though.
Your machine at work will probably have some trouble with it because you are not specifying the SMTP server info. This is the script I use for the same purpose. You will need to edit the script with your info for your SMTP server, domain name and the email address you want the message sent to. All of these settigns are up near the top of the script.
'==========================================================================
'
' VBScript Source File --
'
' NAME: NotifySvcFailure.vbs
'
' AUTHOR: Mark D. MacLachlan , The Spider's Parlor
' DATE : 04/15/2003
'
' COMMENT:
'
' This script can be added to a services actions to be taken on failure
'
' You must customize the entries for oDomain and oMyIP with the proper company information.
' Items to customize are on lines 28 and 30.
'=====================================
Dim oName, ODomain, oMyIP, oTo, svcName
Set svcName = WScript.Arguments
' Get the computer name
Set WshNetwork = CreateObject("WScript.Network"
oName = WshNetwork.ComputerName
' Set the company specific information
' Company Internet Domain Name
ODomain = "myhouse.com"
' Set the SMTP server IP
oMyIP = "68.6.19.4"
' Where do you want the message to be delivered
oTo = "support@thespidersparlor.com"
' Set the visual basic constants as they do not exist within VBScript.
' Do not set your smtp server information here.
Const cdoSendUsingMethod = "
'Create the CDO connections.
Dim iMsg, iConf, Flds
Set iMsg = CreateObject("CDO.Message"
Set iConf = CreateObject("CDO.Configuration"
Set Flds = iConf.Fields
'SMTP server configuration.
With Flds
.Item(cdoSendUsingMethod) = cdoSendUsingPort
'Set the SMTP server address here.
.Item(cdoSMTPServer) = oMyIP
.Update
End With
'Set the message properties.
With iMsg
Set .Configuration = iConf
.To = oTo
.From = oName & "@" & oDomain
.Subject = "Service Failure"
.TextBody = "Service " & svcName & " on Server " & oName & "at company " & ODomain & " failed 2 times, the time of failure was " & now
End With
'An attachment can be included.
'iMsg.AddAttachment Attachment
'Send the message.
iMsg.Send
I hope you find this post helpful. Please let me know if it was.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.