You can use the Task Scheduler to execute a script or command at startup or during the login process but you can’t use it to do the same during the logoff. In order to do so, you will need to go through the local Group Policy Editor, a much more powerful component unique in Windows.
One of the readers left a comment in a post that shows a trick how to make your computer speak out time at every hour asking if he can run this script at logoff. So let’s see how it works.
Prepare a batch file that runs the VBScript
Create a new batch file (.bat file), and add the following line in the file:
Assuming that the VBScript that speaks out the time is saved on user’s desktop. If you are interested in this script, you can download it directly from this link (right-click and save as..).
Then, work on the Group Policy Editor
1. Launch Group Policy Editor, by Win+R, typing in “gpedit.msc“, and pressing Enter.
2. On the left panel, go to User Configuration → Windows Settings → Scripts (Logon/Logoff).
3. Double click Logoff to open up its properties.
4. Click Add button, and Browser… button.
5. In the Browse window, paste in the batch file you created earlier. And then select it, press Open button.
6. Click OK again in Add a Script dialog box. You will see a Logoff.bat file shown up in Logoff Properties window. Click OK to save the changes.
7. Close the Local Group Policy Editor, run the following command in Command Prompt window to update the group policy just to be sure the change takes affect right away.
That’s it. Log off your computer and see how it works.
Note that if you are trying to use it in a domain controlled network, you will need to do the same on a domain controller that has Active Directory installed.
Latest posts by Kent Chen (see all)
- Microsoft To-Do App Available in Preview on Windows 10, iOS and Android - April 19, 2017
- Windows 10 Tip: What’s Mini View in Movies & TV App and How To Use it - April 15, 2017
- Windows 10 Tip: How To Convert MBR Partition to GPT without Losing Data - April 12, 2017
Last updated: 08/04/2014