Solved

How to call a powershell script only after an unscheduled outage

Posted on 2013-11-01
5
291 Views
Last Modified: 2013-11-09
I want to be notified when a machine has had an unscheduled outage, without scanning the event log everytime the machine is restarted.  Windows knows when it has had an unscheduled outage an I'd like to tap into that to kick off the powershell script.  

I don't want to scan the events log because the machine may have had an unscheduled outage earlier in the day and then I would receive a false positive the rest of the day.

Thanks
0
Comment
Question by:c7c4c7
  • 3
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
alicain earned 500 total points
Comment Utility
Hi,

You can achive this by creating an alert based on the unexpected shutdown event that is raised.

This is done in the event viewer.  You do not mention which OS this is for and it is slightly different but broadly the same between versions of Windows.

On Win 7 for example, open computer manager, event log and look in the right hand pane for "Attach a task to this log" and follow the wizzard, it's fairly straightforward but shout if you need further assistance and which OS it is for.

Regards,
Alastair.
0
 

Author Comment

by:c7c4c7
Comment Utility
The Os is mainly Win 7 eventually it will include 8 .  

The reason I don't want to include the Event log is that I will be notified by Text Message when the system comes up.  By including it in the event log I will receive a txt message 1st for a legitimate unscheduled shutdown and then again each time the machine is restarted during the day.  It will require a lot of unnecessary work.

Thanks
0
 
LVL 5

Expert Comment

by:alicain
Comment Utility
I've been pondering this, and how about attaching the powershell script to the event as previosuly discussed and then put logic into the script to determine if an email is to be sent?
e.g. If time event was raised between 9am and 5pm, do nothing, else, send an alert?
0
 

Author Comment

by:c7c4c7
Comment Utility
I will play with this idea and see what I can come up with.  I will get back to you
0
 

Author Closing Comment

by:c7c4c7
Comment Utility
Its working out pretty good, no false positives.  Thanks for the help
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

When you upgrade from Windows 8 to 8.1 or to Windows 10 or if you are like me you are on the Insider Program you may find yourself with many 450MB recovery partitions.  With a traditional disk that may not be a problem but with relatively smaller SS…
Set OWA language and time zone in Exchange for individuals, all users or per database.
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

763 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

10 Experts available now in Live!

Get 1:1 Help Now