How To Create A Reminder or Popup on Shutdown

Page 4 of 5 FirstFirst ... 2345 LastLast

  1. Posts : 17,015
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #31

    Chris Nicola said:
    Thank you for your reply Denis. I am afraid i have not got that far yet. I have only entered the event trigger as shown in the screenshot below. This trigger doesn't seem to do anything at shutdown.
    Chris,

    It's not that you have not got that far, it's that you have skipped over it and created the TS task yourself. That's fine.
    Make sure you have clicked on Enable all tasks history on the right-hand side of TS.
    Double-click on the task to show its properties tabs, select History, widen the columns by dragging their dividers around [you have to do this every time you look], see whether the task ran or not.
    In my test, my simple script ran.

    Your script baffles me.
    The script runs when you are already shutting down but you are using it to issue a shutdown command.
    I suggest an alternative script, a batch script, for testing purposes.

    You will need to change the TS task properties, General tab; set the checkbox for Run with highest privileges.

    You will need to change the folder path in the TS task action & in the batch file to point to a real folder on your computer.
    TempTest.bat
    echo This ran at %Date% %Time% >>D:\Desktop\TempTestResults.txt
    and change the TS task Action to
    D:\Desktop\TempTest.bat

    When you've seen that that works, add an additional action to run a vbs MsgBox script. I suggest the one in my post #20.
    How To Create A Reminder or Popup on Shutdown-temptestactions.png

    That will demonstrate that the task runs, the TempTestResults.txt gets updated but the MsgBox does not display.
    You can repeat the test with Run whether the user is logged on or not and you'll get the same results - you will hear a beep when the vbs tries & fails to display the MsgBox.

    Now you will need to go back to in my post #8 and use NirSoft FullEventLogView to look for an event earlier in the shutdown process - before the logoff event.
    - You will need one that still works even without Run with highest privileges or Run whether the user is logged on or not set because you want other users to do this.
    - The Logoff events are
    Log Microsoft-Windows-User Profile Service/Operational
    Source User Profile Service
    EventIDs 3,4
    When moving back and forth with logs, do note that the time recorded in TempTestResults.txt are slightly delayed because it takes time to write in that file. In my tests this was about a second.
    This is all rather painstaking & extremely dull.


    I appreciate that all this will make you think you don't know how to do it but that is not true.
    You have demonstrated that you know how to run a TS task for an EventID and that's the sophisticated part of the job.
    Now all you need to do is find an event that fits in with your needs.


    All the best,
    Denis
    Last edited by Try3; 04 Sep 2022 at 11:44.
      My Computer


  2. Posts : 145
    Windows 10
    Thread Starter
       #32

    Thank you again Denis for your helpful comments and motivation. When I get a bit of time I will tackle it again.

    Kind regards
    Chris
      My Computer


  3. Posts : 323
    Pro 20H2
       #33

    How To Create A Reminder or Popup on Shutdown-usersession.jpg

    Let's dismiss the description,
    and just take one of the triggers as named : "On connection to user session". Seems to me that we necessarily and immediately are connected to the session that is established in response to our login; thus no practical difference from trigger "At log on".

    But there must be some practical difference to justify the presence of both in the list of triggers?
      My Computer


  4. Posts : 145
    Windows 10
    Thread Starter
       #34

    I wish to thank everyone for their replies. I am not a programmer, so need step by step instructions.

    Although this is an old thread, this week I decided to try again and have succeeded with the help of "Chat GPT". Previously Chat GPT was unable to solve the problem. Evidently, it has improved since then. The difficulty was to find the correct shutdown trigger; Chat GPT found it!

    There are two possible solutions I have found to have a pop up reminder message on shutdown. (I will leave the idea of a pop up image reminder for another day)

    Solution 1 (I tested it and it works on my PC) I might add that in the "General" tab in task scheduler I also checked to run with highest privileges. Another option is to run only when the user is logged on or whether the user is logged on or not.

    Chat GPT prompt:
    How do I create A Reminder or Popup on Windows 10 Shutdown using task scheduler?

    Chat GPT Reply
    To create a reminder or popup on Windows 10 shutdown using Task Scheduler, you can follow these steps:
    1. Open Task Scheduler: Press Win + R to open the Run dialog, type taskschd.msc, and press Enter.
    2. Create a New Task:
    • In the Task Scheduler window, click on "Create Task..." in the right-hand Actions pane.
    • Name your task and provide a description if you wish.
    3. Trigger Setup:
    • Go to the "Triggers" tab and click "New".
    • Choose "Begin the task: On an event".
    • Set "Log" to System.
    • Set "Source" to User32.
    • Set "Event ID" to 1074. This event ID is logged when the system is shutting down.
    4. Action Setup:
    • Go to the "Actions" tab and click "New".
    • Choose "Start a program" as the action.
    • In the "Program/script" field, enter cmd.exe.
    • In the "Add arguments" field, enter /c msg * "Your reminder message here". Replace "Your reminder message here" with the message you want to display as the reminder. The msg * command displays a message box to all users currently logged on to the system.
    5. Conditions (Optional):
    • You can set any conditions you want under the "Conditions" tab. For example, you might want to run the task only if the computer is idle, or only if it's on AC power.
    6. Save and Exit:
    • Click "OK" to save the task.
    Now, whenever the system is shut down, the reminder message you specified will pop up. Make sure to test it to ensure it's working as expected.

    Solution 2 (I didn't yet test it on my PC, but it should work) I would suggest that in the "General" tab in task scheduler to check to run with highest privileges.

    Chat GPT prompt:
    How do I create A Reminder or Popup on Windows 10 Shutdown using task scheduler and a batch file?

    1. Create a Batch File: Open Notepad or any text editor and create a new file with a .bat extension. For example, let's name it shutdown_reminder.bat.
    2. Edit the Batch File: Add the following command to the batch file:
    batch
    Copy code
    @echo off msg * "Remember to save your work! System is shutting down soon."
    3. Save the Batch File: Save the batch file to a location where you can easily access it.
    4. Open Task Scheduler: Type "Task Scheduler" in the Windows search bar and open it.
    5. Create a New Task:
    • Click on "Create Basic Task" in the right-hand pane.
    • Follow the wizard to give your task a name and description.
    6. Set the Trigger:
    • Choose "When a specific event is logged" as the trigger.
    • Click "Next."
    7. Configure the Trigger:
    • Log: System
    • Source: User32
    • Event ID: 1074
    • Click "Next."
    8. Action:
    • Choose "Start a program."
    • Click "Next."
    9. Select Program/Script:
    • Browse and select the batch file you created (shutdown_reminder.bat).
    • Click "Next."
    10. Finish: Review your settings and click "Finish" to create the task.
    Now, whenever the system is shut down, the batch file will display a reminder message.

    Kind regards
    Chris
      My Computer


  5. Posts : 323
    Pro 20H2
       #35

    Chris Nicola said:
    Solution 1 (I tested it and it works on my PC)

    Not in mine :
    How To Create A Reminder or Popup on Shutdown-evt1074.jpg
      My Computer


  6. Posts : 145
    Windows 10
    Thread Starter
       #36

    Thanks for your reply. Are you running Win 10? The instructions may vary for Win 11.

    In task scheduler in the general tab, did you check to run with the highest privileges? There is also an option in the general tab to run the task whether the user is logged on or not. You could also check the cmd arguments code is correct.
    c msg * "Your reminder message here" (include the quotes)

    Kind regards
    Chris

    How To Create A Reminder or Popup on Shutdown-task-scheduler.jpg
      My Computer


  7. Posts : 323
    Pro 20H2
       #37

    Chris Nicola said:
    The instructions may vary for Win 11.
    No.


    Chris Nicola said:
    run with the highest privileges?
    Yes.


    Chris Nicola said:
    run the task whether the user is logged on or not.
    Yes.


    Chris Nicola said:
    cmd arguments code is correct
    Irrelevant. Shutdown prevents it from starting.
    (And yes, it is correct. Works when task is run manually.)
      My Computer


  8. Posts : 145
    Windows 10
    Thread Starter
       #38

    You could try to double check the triggers. I have posted my screenshot below.

    The shutdown should start the task not block it. Maybe someone else can shed some light?

    Kind regards
    Chris

    How To Create A Reminder or Popup on Shutdown-triggers.jpg
      My Computer


  9. Posts : 323
    Pro 20H2
       #39

    Chris Nicola said:
    I have posted my screenshot
    Identical to mine.
    Thanks.

    - - - Updated - - -

    The thought occurred to me that perhaps not every1074 is equal for this purpose.
    Indeed the behavior differed :
    task action does not start when 1074 is generated by system restart,
    task action does start when 1074 is generated by system shutdown.

    Then I looked into the logs :
    How To Create A Reminder or Popup on Shutdown-1074restart-shutdown1.jpg

    (Tried to thank Try3, because viewing logs in the Nirsoft utility is less burdensome than in the MS utility. Of course.)
    How To Create A Reminder or Popup on Shutdown-tmp.jpg
    Attached Thumbnails Attached Thumbnails How To Create A Reminder or Popup on Shutdown-tmp.jpg  
    Last edited by thename; 1 Week Ago at 11:07.
      My Computer


  10. Posts : 17,015
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #40

    thename,

    I've changed my mind since then because I have learnt more about getting the best out of Event viewer.
    1 It is easy to make a filterable version of Event viewer's built-in Custom view Administrative events i.e. all events.
    2 That view & its filterable copy is in chronological order by default [just as the NirSoft tool is].
    3 Event viewer can be opened multiple times at once [multiple 'instances']. So we can have one that's looking at the Admin events view, another where you've filtered down to something specific, another showing some log's subfolder of a subfolder of a subfolder ... And, like almost all windows, they can be arranged side by side etc as desired.

    So I have stopped using the NirSoft tool.
    I can temporarily filter the Admin view by, say, EventID 1074 then click through several of them to see their Log & Source entries to check that they are the same Event 1074s. I do not know if 1074 exists in different logs-sources where they have different meanings but some events do.

    Unlike most Custom views, this one has to be made on the computer concerned and not imported from another one. The reason is that event logs & hence some views contain hardware-specific events.
    Creating the filterable version is quick & painless.
    Make customisable Event viewer, Custom view, Administrative Events [post #4] in Windows 10 and 11 - TenForums
    I now call mine Administrative events - Filterable because that's what it's for.


    All the best,
    Denis
      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:17.
Find Us




Windows 10 Forums