I have several mounted (windows share) network drives on my Dell laptop. I need them for my daily work. However, at the end of the day I want to close them and clear up some other stuffs. I can use Group Policy(GP) editor snap-in to assign logoff scripts as described here and a screenshot shown below:
But, GP editor may not be availble on all versions of Windows 7. The alternative, I figured out, is to use Task scheduler that comes (probably?) with all flavors of Windows 7. Task scheduler in Windows 7 is really nice, but, I did not find a way to invoke a script when I logout from my computer or shut it down at the end of day's work. The workaround is to create a task that triggers "when some event is logged". To use this alternative, follow these steps:
1. Start task scheduler
2. Enter General properties:
3. Go to Trigger tab and event details as follows:
4. Enter action details:
5. Rest of the settings can be left default or changed as per needs
6. Save the task and test the script is invoked by manually restarting the computer.
That is all that needed to run a script on logout (shutdown actually) from task scheduler.
Note: this way script is fired only at shutdown actually. I did not find a easy way to trigger logout security events. I tried with event IDs 4634 and 4647, both did not work as expected.
But, GP editor may not be availble on all versions of Windows 7. The alternative, I figured out, is to use Task scheduler that comes (probably?) with all flavors of Windows 7. Task scheduler in Windows 7 is really nice, but, I did not find a way to invoke a script when I logout from my computer or shut it down at the end of day's work. The workaround is to create a task that triggers "when some event is logged". To use this alternative, follow these steps:
1. Start task scheduler
2. Enter General properties:
3. Go to Trigger tab and event details as follows:
4. Enter action details:
5. Rest of the settings can be left default or changed as per needs
6. Save the task and test the script is invoked by manually restarting the computer.
That is all that needed to run a script on logout (shutdown actually) from task scheduler.
Note: this way script is fired only at shutdown actually. I did not find a easy way to trigger logout security events. I tried with event IDs 4634 and 4647, both did not work as expected.
3 comments:
Thank you for your explanation!
I found this:
http://social.technet.microsoft.com/Forums/windows/en-US/eeddeffb-7f06-4cc7-9615-56f374f6157d/task-scheduler-trigger-logout?forum=w7itproinstall
Perhaps you want to test/add the event described.
I tried it but in this way the task manager launches the program and, after few seconds, starts the shutdown while the program is still running. It's a big problem!
Hi. I was very excited by this prospect and have wanted to do this for years. However, I also found that Windows 7 shutdown without waiting for the program to complete. Did you find a solution to this???
Post a Comment