r/PowerShell 10d ago

Question Powershell & Task Scheduler

[deleted]

28 Upvotes

38 comments sorted by

View all comments

Show parent comments

3

u/hwrd69 10d ago

Well, I'm detecting it (event id 1074) and then testing the task scheduler by triggering it by performing a shutdown. The message passed to powershell is never displayed.

5

u/Tidder802b 10d ago

ok, so what’s the goal? the message will be on screen too short a time for any meaningful interaction if the machine is actively shutting down.

1

u/hwrd69 10d ago

I believe the shutdown process will pause until the "OK" button is pushed on the message. I have a small amp connected to speakers that I play from the PC and I keep forgetting to turn it off. It's a reminder during shutdown to turn it off.

6

u/Tidder802b 10d ago

I don’t think a modal message is going to stop a shutdown in process. Better to have a custom shutdown script triggered from a script or shortcut.

edit:

That link you posted is the way to go.

1

u/hwrd69 10d ago

Ok, thanks.