0
Since I always forget to close my window at work, I'm trying to display a small message box to remind me when I shut down my computer.
The script is easy enough:
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.MessageBox]::Show('Close your window', 'LogOff Reminder', 0)
The problem is, I can't get my system, windows 10, to run it at shutdown. I tried setting up a policy with gpedit.msc
. I also tried setting up a task with taskschd.msc
.
I have two ideas what the problem might be:
- The point in time when the script is run is already to late for graphical feedback, the system is already shut down to far.
- My system doesn't do a real shut down, but merely hibernates in support of fast boot.
Has anybody ever gotten this to work? Could you point out how?
Thanks in advance!
1Shutdown scripts run in SYSTEM context, not USER context. You won’t see any output from something running in SYSTEM context on a user’s screen. In task scheduler you may be able to fix this with the “run as logged on user,” option. You also can’t prevent a shutdown by simply displaying a prompt on the screen. I imagine there is a way to interrupt or delay the shutdown but not by just displaying a prompt. I also know shutdown scripts usually run after the user session has ended. – Appleoddity – 2018-05-25T12:37:38.510
@Appleoddity Thanks for dropping some extra buzzwords for me to research. I will check back in, if I find something in that direction. – Ruben Bohnet – 2018-05-25T12:51:07.633