Solved

Windows 2012 Task Scheduler

Posted on 2014-03-17
7
489 Views
Last Modified: 2014-04-20
Hi.  Windows 2012 no longer supports sending of an email in Task Scheduler therefore, I need to find a way to have an email generated when the server is rebooted.  Is this possible in Powershell and then call a powershell script on reboot?  Or perhaps a tool such as blat and  call blat?  Thx.
0
Comment
Question by:rrsmithab
  • 4
  • 2
7 Comments
 
LVL 10

Expert Comment

by:Scott Thomson
ID: 39935896
Can i possibly ask you a question. What is the reason you would like a server to notify you of a reboot? do you not have software such as solarwinds or SCOM systems?
0
 
LVL 23

Expert Comment

by:Mysidia
ID: 39935923
Personally;  I would suggest you  have monitoring software, such as  PRTG, Spiceworks, Nagios, ManageEngine Opmanager,  Solarwinds,  WhatsUp, or SCOM, on  another server to detect the reboot.      What happens when the server begins to reboot,  but  does not come back online  --- accidental shutdown,  or hang while shutting down, instead of successful reboot?   Then  you won't get an e-mail, that's what.....

I believe you can move this  e-mail thing over to 2012 by creating a VBScript;  .VBS file in notepad, and  schedule the VBScript,  though.

http://forums.asp.net/t/1618178.aspx?How+to+create+and+emails+Script+in+VBScript+

Imports System.Net.Mail
Imports System.Net

Dim Dest As New System.Net.Mail.MailAddress("recipient@example.com")
Dim msg As New System.Net.Mail.MailMessage
Dim smtp As New System.Net.Mail.SmtpClient

smtp.Host = "mymailserver.example.com"

msg.body = "Your message here"
msg.From = New Net.Mail.MailAddress("sender@example.com")
msg.Priority = Net.Mail.MailPriority.High
msg.Subject = "Hello, there!"

msg.IsBodyHtml = False
msg.To.Clear()
msg.To.Add(Dest)

smtp.send(msg)
0
 

Author Comment

by:rrsmithab
ID: 39975634
Thanks for trying to save me some work but there is an issue with the code and it failed.  The reason we want to do this is a safety net or plan B in case notifications don't go out.  We had a server reboot but neither vmware nor Opsview caught the reboot.  But it's in the logs of the server.
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Accepted Solution

by:
rrsmithab earned 0 total points
ID: 39986469
Solution is that Powershell has a sendmail cmdlet that works in Task scheduler.  Thanks to everyone for their assistance.
0
 
LVL 10

Expert Comment

by:Scott Thomson
ID: 39986573
No worries, glad you managed a solution
0
 

Author Comment

by:rrsmithab
ID: 39992064
Thanks.
0
 

Author Closing Comment

by:rrsmithab
ID: 40011150
Found solution on my own.
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Every now and then, Microsoft does something that totally impresses me. It doesn't happen often, but in this case I must say I am thoroughly impressed with Windows Server Backup. One of the long time issues with Windows Backup has been the ability t…
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
In this Micro Tutorial viewers will learn how they can get their files copied out from their unbootable system without need to use recovery services. As an example non-bootable Windows 2012R2 installation is used which has boot problems.
In this Micro Tutorial viewers will learn how to restore single file or folder from Bare Metal backup image of their system. Tutorial shows how to restore files and folders from system backup. Often it is not needed to restore entire system when onl…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now