Solved

How to call a powershell script only after an unscheduled outage

Posted on 2013-11-01
5
294 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
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
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…
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…

856 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