How to schedule a windows task to be run at logoff

Good morning,
I'm working with a Windows 7 computer.
I would like my computer to warn me about something I may not forget, at every time I log off from my system.

In order to do this, I am thinking of the "Windows Task Scheduler".
However, in the list of possible triggers (the "Begin the task" combobox), I only see the following possibilities:

  • On a schedule (fix date/time)
  • At log on (while logging into the PC)
  • At startup (while starting the PC)
  • On idle (when the PC is not occupied with other tasks, I presume)

I don't see the possibility "At log off" or "At shutdown".

Does anybody know if this possibility can be added (maybe by handling the registry)?



  • As far as I have researched there is a simple reason why this is not supported. It can not be guaranteed that the task scheduler service is running at the point the logoff event is fired, and if it were it could not be guaranteed that the script you start with it would not be terminated immediately by the shut down of your computer.

    You can bypass this by adding a trigger "on an event" and using one of the event ids of the shutdown but for the reasons stated above, it might not be the best idea.

    I would rather recommend using a shutdown/logoff script defined per policy. This is the official method for such things and it is guranteed to execute completely before a shutdown/logoff. If you got a Windows version with GPO support you can just start gpedit.msc and Go to Computer Configuration\Windows Settings\Scripts for Shutdown and User Configuration\Windows Settings\Scripts for logoff scripts and create yours. A detailed article explaining those scripts can be found here.

    If your OS version does not support GPOs you should be able to recreate the necessary registry entries. I did not try this myself but several articles seem to suggest that what you'd need is:

    Windows Registry Editor Version 5.00
    "DisplayName"="Local Group Policy"
    "GPOName"="Local Group Policy"

    put into a .reg file. The only line you'd need to to change is: "Script"="C:\\bin\\shutdownscript.cmd"