Announcement

Collapse
No announcement yet.

alert shutdown and restart

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • alert shutdown and restart

    hi!
    i need a script that send me mail
    when comp on the domain shutdown or restart
    i need the time and date
    appear on subject to my mail.
    i think that will be a great script helpful.

  • #2
    Re: alert shutdown and restart

    Have you had a look at any of these:

    http://www.petri.com/sendmail.htm
    This is my signature.

    Comment


    • #3
      Re: alert shutdown and restart

      aharonaf,
      Here are the two scripts that i use for my domain. I have it applied to the OUs that have our servers in them. With a couple of simple edits to these scripts, you can have it working in no time. One thing, and it caught me the first time i put these in place, you need to set them as Startup and Shutdown scripts, not logon and logoff scripts.


      Shutdown Script:
      Code:
      Set objNetwork = CreateObject("Wscript.Network")
      strComputer = objNetwork.ComputerName 
      Set objEmail = CreateObject("CDO.Message")
      objEmail.From = strComputer & "@ENTERYOUR DOMAIN HERE(i.e. XYZ.com)"
      objEmail.To = "ENTER RECIPIENT EMAIL ADDRESS HERE"
      objEmail.Subject = "Reboot Requested" 
      objEmail.Textbody = "An admin has requested a reboot of " & strComputer & ".  Please ignore alerts, unless they last more than 15 minutes."
      objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
      objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "ENTER MAIL SERVER NAME HERE"
      objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
      objEmail.Configuration.Fields.Update
      objEmail.Send
      Startup Script:
      Code:
      Set objNetwork = CreateObject("Wscript.Network")
      strComputer = objNetwork.ComputerName 
      Set objEmail = CreateObject("CDO.Message")
      objEmail.From = strComputer & "@ENTER DOMAIN NAME"
      objEmail.To = "RECIPIENT EMAIL ADDRESS"
      objEmail.Subject = "Reboot Completed" 
      objEmail.Textbody = "An admin has requested a reboot of " & strComputer & ".  That reboot has completed and the server should be completely operational."
      objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
      objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "MAIL SERVER NAME"
      objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
      objEmail.Configuration.Fields.Update
      objEmail.Send
      I have been using these scripts for the past year or so, and they are great. Our Auditors love them, we can show an additional level of monitoring of our systems.

      Hope this helps

      app

      Comment


      • #4
        Re: alert shutdown and restart

        thanks alot.
        i will try it today

        Comment

        Working...
        X