'How to monitor for new evets in eventlog and trigger an action
I would like to know the logic or the piece of powershell code that can be used to monitor for a service shutdown event and trigger an action. So when the service stopped event is written to the eventlog, powershell should detect that and trigger the action. But this service start/stop actions can be several at a given time. So I want to run the powershell script every 5 minutes, detect whether there is a service shutdown event within that time frame and trigger an action. How can I achieve this? Any help would be greatly appreciated.
Thanks.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|