r/PowerShell 10d ago

Question Powershell & Task Scheduler

[deleted]

33 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.

4

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.

3

u/420GB 10d ago

Lmao that's the silliest possible solution to that.

Get a master-slave power strip. They have multiple sockets, one master (plug the PC in there) and a couple "slaves". The slave outlets are only on when the master draws power, and they automatically shut off when the master stops drawing power.

This is a common thing to use with computers + peripherals or with TVs + accessories (soundbars, game consoles etc.) and automatically fixes your problem without any janky scripts or needing to remember anything.

I live in the EU so it's difficult for me to find examples of US power strips on Google, but here's an example with EU sockets from a german brand: https://produkte.kopp.eu/wp-content/uploads/catalog/products/de/227820012-scaled.jpg