?
Solved

How to call a powershell script only after an unscheduled outage

Posted on 2013-11-01
5
Medium Priority
?
299 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
alicain earned 2000 total points
ID: 39618645
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
ID: 39619268
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
ID: 39621038
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
ID: 39622644
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
ID: 39636104
Its working out pretty good, no false positives.  Thanks for the help
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
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). …

741 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