question

phantom2000-5377 avatar image
0 Votes"
phantom2000-5377 asked LimitlessTechnology-2700 answered

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.

windows-serverwindows-server-powershell
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

RichMatheisen-8856 avatar image
0 Votes"
RichMatheisen-8856 answered
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

LimitlessTechnology-2700 avatar image
0 Votes"
LimitlessTechnology-2700 answered

Hello

Thank you for your question and reaching out. I can understand you are having query related to Actions while Windows Events occurred.

Scheduled Tasks should get invoked whenever the event Trigger conditions are met.
Depending on the Action that is being executed (e.g. Start a program) that may run continually until the process / application is terminated. Event based Triggers should be able to run from startup and before logon.



--If the reply is helpful, please Upvote and Accept as answer--

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.