0

I want to write a powershell script that get executed whenever a new item/eventlog entry in the eventlog 'Microsoft-Windows-TerminalServices-Gateway/Operational' gets written.

It is easy to create a scheduler task that triggers whenever a new eventlog item gets created and that then execute a powershell script.

Now my question is, inside that powershell script, how can I access the eventlog-item that has triggered the trigger?

Chris9834
  • 151
  • 1
  • 11

1 Answers1

0

OK, found some info. Seems you need to hack the task definition to let it pass over the values as variables to the called script.

See:

see: https://michlstechblog.info/blog/windows-passing-parameters-to-event-triggered-schedule-tasks/ https://cloudrobots.net/2014/08/24/trigger-a-powershell-script-from-a-windows-event/ https://community.spiceworks.com/how_to/123434-run-powershell-script-on-windows-event

Chris9834
  • 151
  • 1
  • 11