How To Create A Reminder or Popup on Shutdown

Page 2 of 5 FirstFirst 1234 ... LastLast

  1. Posts : 1,829
    Windows 10 Pro (+ Windows 10 Home VMs for testing)
       #11

    Chris Nicola said:
    It seems there is not a simple Windows app that can do this.
    If you have a Pro edition of Windows 10 then there's a simple method. You can configure Local Group Policy to run a Shutdown script to popup a message instead of using Task Scheduler. It's a little bit long-winded (about 10 steps within the Microsoft Management Console) but you only need to do it once and is the 'Microsoft way' of doing this.

    The actual shutdown script can be as simple as a one-line VBS file. For example:
    Code:
    x=msgbox("Click OK to continue shutting down." ,16, "Important!")

    shows this centred on screen:
    How To Create A Reminder or Popup on Shutdown-vbs_message.png

    (See How To: Make a Message Box Using VBScript for more info. For example, it can be made modal so nothing else can be clicked on except the 'OK' button of the message dialog.)

    The important thing is that the 'Shutdown script' method suspends the Shutdown process until the script has finished processing.

    Hope this helps... post back if you're interested and I'll see if I can write step-by-step instructions.

    Note: I don't believe Home editions support this method, even if you manually add the policy to the registry.
      My Computer


  2. Posts : 145
    Windows 10
    Thread Starter
       #12

    Thank you very much Rick. This is something that would work as the user must see the message before shutting down. My personal PC is Win 10 pro, but unfortunately the particular PC I wish to modify is only Win 10 Home.

    Kind regards
    Chris
      My Computer


  3. Posts : 1,829
    Windows 10 Pro (+ Windows 10 Home VMs for testing)
       #13

    Chris Nicola said:
    This is something that would work as the user must see the message before shutting down. My personal PC is Win 10 pro, but unfortunately the particular PC I wish to modify is only Win 10 Home.
    On the Win 10 Home PC, see if there's a C:\Windows\System32\GroupPolicy\Machine\Scripts\Shutdown folder. If so then there's a possibility this may still work even though there won't be a Local Group Policy editor (so the registry entries would have to be merged from a REG file). Sorry - I don't have access to a device running Home to test.

    For interest, the MMC console in Pro created the following REG entries:
    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\Scripts\Shutdown]
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\Scripts\Shutdown\0]
    "GPO-ID"="LocalGPO"
    "SOM-ID"="Local"
    "FileSysPath"="C:\\Windows\\System32\\GroupPolicy\\Machine"
    "DisplayName"="Local Group Policy"
    "GPOName"="Local Group Policy"
    "PSScriptOrder"=dword:00000001
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\Scripts\Shutdown\0\0]
    "Script"="message.vbs"
    "Parameters"=""
    "IsPowershell"=dword:00000000
    "ExecTime"=hex(b):00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
      My Computer


  4. Posts : 145
    Windows 10
    Thread Starter
       #14

    Thank you Rick, I will look into that option.

    Kind regards
    Chris
      My Computer


  5. Posts : 17,021
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #15

    RickC said:
    If you have a Pro edition of Windows 10 then there's a simple method. You can configure Local Group Policy to run a Shutdown script to popup a message instead of using Task Scheduler. It's a little bit long-winded (about 10 steps within the Microsoft Management Console) but you only need to do it once and is the 'Microsoft way' of doing this.
    Rick,

    I do not have Pro.

    Does the policy setting you describe create a Task scheduler task [which I'd expect to be in the TS sub-folder Event viewer tasks]?
    That's how other Event viewer triggers are implemented - "Attach Task to this Custom view".
    If so, would you mind posting its .xml task definition. I'd like to see which of the many shutdown events it's latching onto because it's probably the most appropriate one for me to use if I ever have a similar need.
    It's the <Subscription> field.

    That definition can also be accessed through the UI:-
    TS,
    Event viewer tasks,
    {selected task},
    Properties,
    Triggers,
    Edit,
    Edit Event filter,
    XML tab.
    How To Create A Reminder or Popup on Shutdown-ts-event-viewer-trigger.png



    Chris,

    I thought you wanted some big red diagram instead of a neat vbs MsgBox.
    If the expectation expressed in my question to Chris is correct, you'd be able to implement it in Home just as well as in Pro.

    You do realise that the MsgBox he used as his example normally stays onscreen forever?
    It will take experimentation to find out if the shutdown process overrides it {i.e. closes the MsgBox} and continues anyway. I suspect that it will not override it but do not know that.
    Variations of MsgBox ["Popup" MsgBoxes] can be designed to stay onscreen for specific periods so you'd need to decide what you wanted [assuming my expectation is correct].


    All the best,
    Denis
      My Computer


  6. Posts : 145
    Windows 10
    Thread Starter
       #16

    Denis, thanks again for your reply. Yes the option of showing a large message with a bright background would be ideal (or play a 5 second mp4 video with the same message) before shutdown. However, after fiddling around with task scheduler it appears that it can't be done (or I don't have the ability to do it). I tried a few times with TS and get errors and am forced to cancel.

    So this alternative method might be another option, ie showing a box with a reminder that the user has to press OK before shutdown will also get someone's attention.

    As I have a hectic schedule, I have not yet had a chance to study all the links. I hope to get round to that asap.

    Kind regards
    Chris
      My Computer


  7. Posts : 1,829
    Windows 10 Pro (+ Windows 10 Home VMs for testing)
       #17

    Try3 said:
    Does the policy setting you describe create a Task scheduler task [which I'd expect to be in the TS sub-folder Event viewer tasks]?
    Hi Denis,

    No, it's nothing to do with Task Scheduler. Instead I believe the shutdown script method is an event-driven hook to shutdown.exe that causes shutdown.exe to suspend execution until the shutdown script terminates. The script itself can be BAT, vbscript, jscript and/or PowerShell.

    Unfortunately Microsoft documentation now appears sparce and becoming even less, but have a look at Working with startup, shutdown, logon, and logoff scripts using the Local Group Policy Editor for more info. It's old (Windows 7) but I haven't been able to find any more recent Microsoft documentation.

    Martin Brinkman also has some good info in the ghacks.net Back to Basics: Windows Shutdown Autostart explained article. It's about Windows 8 but the methodology hasn't changed.

    Before I retired we used to use Local Group Policy startup and shutdown scripts all the time for roving laptops that were never connected to the corporate network. Once configured the scripts appeared more resilient than using Task Scheduler... and easier to set up quickly. Another advantage was that they ran in the Local System context (i.e. machine-wide) so were triggered irrespective of who logged on. The caveat of course is that none of our devices were running Home editions, which is why I have no experience... nor any means to test.

    Hope this helps...
    Last edited by RickC; 29 Aug 2022 at 17:56.
      My Computer


  8. Posts : 17,021
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #18

    Rick,

    The reason I had thought/hoped it might be in that TS sub-folder was because that's how Windows implements EventViewer-set tasks.
    Oh, well.


    Chris,

    This leaves you floundering around trying to pick an Event to try to latch any MsgBox / popup notice to.
    I explained how I would look for them in my post #8.
    Choosing which to use as a trigger for a MsgBox / popup notice would have to be deduced from rather repetitive experimentation that might, ultimately, be unsuccessful.

    All the best,
    Denis
      My Computer


  9. Posts : 145
    Windows 10
    Thread Starter
       #19

    I had a go with task scheduler. The problem is the option to make a message box has been disabled my microsoft (depreciated), although evidently there are work arounds with Power Shell.

    Solution for task scheduler error 2147750704 send email - Message Display

    I did find some vbs script online to make an Click OK/message box online, but this does not launch when the shutdown button is pressed. Its an independent executable that makes a message popup/OK to clear/ then the machine shuts down. This is not what I want.

    The other problem is figuring out the event that starts when the shutdown button is pressed.

    According to the link Dalchina kindly sent it is:

    windows 7 - Using Task Scheduler to Run a Task Before Shutdown - Super User

    Log : System
    Source : User32
    EventID : 1074

    I really don't know if event ID 1074 still applies to Win 10 Home


    On Windows 7 this was a recommended vbs script for a pop up message on shutdown.

    Display reminder when click on shutdown? - Windows 10 Forums

    I have no idea if that will work on Win 10.

    I am wondering if I would be better off sticking with Windows task scheduler or a vbs script.

    Task scheduler does offer a method to launch an exe file. I suppose that exe file could be a self contained .exe executable video with the reminder message.

    I am the administrator of this computer in question but am not the owner. It is used my many to show presentations and connect to Zoom. So whatever I do, I must be sure it will not upset the system, and is easily reversible in case something goes wrong.

    Once I have found a script that works I can try it.

    The other problem is finding the shutdown event when the button is pressed.

    Kind regards
    Chris

    PS. I have tried to include copied vbs script in this post but I am blocked from posting so i had to remove it. Does anyone know why?

    PPS. I have tried various paper sticky notes. They work for about a week or two. Then they fade into the subconscious and are ignored. That's why I would prefer some kind of an on-screen reminder.
      My Computer


  10. Posts : 17,021
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #20

    I can help with the Event viewer work, the TS task and the script that TS will run.
    but
    I do not know which of the various events during shutdown is the best one to latch on to as explained in my post #8.
    EventID 1074 is one of the events that happens during shutdown [for Home, Pro, also for Win11] so I imagine you will want to use that for your first experiment.


    You will need to set the chosen event in Event viewer as a Custom view then attach a task to it [which it actually sets up in Task scheduler, Task scheduler library, Event viewer tasks].
    - I have some notes about attaching tasks
    - - 1 Set up a Custom view for that EventID - example my posts in Set up an EventViewer-triggered task in TS - ElevenForum
    - - 2 Use "Attach task to this Custom view"
    - - 3 I suggest that you start off by just telling TS to run notepad.exe as the task so you can test that you've set up the attaching task bit correctly. You'll then edit the task directly in TS.
    I know you'll have lots of questions. Once you've done this a few times you'll regard it as straightforward but it all seems weird the first time.


    I can help with the real task.
    - paste this into Notepad and save it as WhateverYouWant.vbs You can then double-click on it to run it manually to test it, it is benign as it just displays a message.

    Code:
    ThePrompt = "Here it is the prompt, do whatever you want"
    TheTitle = "Here is the shutdown warning message"
    TheButtons = 48
    ReturnValue = MsgBox(ThePrompt, TheButtons, TheTitle)
    - Then, in TS, go to the Task scheduler, Task scheduler library, Event viewer tasks subfolder [the left-hand pane expands just like expanding folders in File explorer]
    - Double-click on the task to open its properties and select the Actions tab.
    - Overwrite your initial Notepad.exe example with
    Program/Script: wscript.exe
    Add arguments (optional): C:\Tools\ShutdownStuff\WhateverYouWant.vbs
    {use the path to the folder where you've put it in place of my C:\Tools\ShutdownStuff}
    {I will nag you later about suitable places to store the vbs when you've finished testing it.}
    {Use whatever you have called the vbs file in place of my WhateverYouWant.vbs.}
    then click on various OK buttons to finish.
    You can now right-click on the task & select Run to test that the task has been set up correctly.

    Then the real test, shutdown to see what happens.


    Then
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 05:49.
Find Us




Windows 10 Forums