'==========================================================================
'
' VBScript Source File --
'
' NAME: NotifyReboot.vbs
'
' AUTHOR: Mark D. MacLachlan , The Spider's Parlor
' URL: [URL unfurl="true"]http://www.thespidersparlor.com[/URL]
' DATE : 02/13/2003
'
' COMMENT:
'
' This script can be added to a machines startup script in Group Policy to notify
' an e-mail address that the machine has restarted.
'
' You must customize the entries for oDomain, oMyIP and oTo with the proper company information.
' Items to customize are on lines 29, 31 and 33.
'=====================================
Dim oName, ODomain, oMyIP, oTo
' Get the computer name
Set WshNetwork = CreateObject("WScript.Network")
oName = WshNetwork.ComputerName
' Set the company specific information
' Company Internet Domain Name
ODomain = "yourdomain.com"
' Set the SMTP server IP
oMyIP = "192.168.1.1"
' Where do you want the message to be delivered
oTo = "admin@youraddress.com"
' Set the visual basic constants as they do not exist within VBScript.
' Do not set your smtp server information here.
Const cdoSendUsingMethod = "[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing",[/URL] _
cdoSendUsingPort = 2, _
cdoSMTPServer = "[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver"[/URL]
' 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 = "Server Reboot"
.TextBody = "Server " & oName & " at company " & ODomain & " was restarted " & now
End With
' An attachment can be included.
'iMsg.AddAttachment Attachment
'Send the message.
iMsg.Send
MsgBox "Done"