Trigger script when event occurs with PowerShell 7.4

Sorry, I kindly ask the moderators to delete this post, because it’s a duplicate of another one: I thought I made an error when posting the first time, so I made a second attempt.

I really apologize.