The following process describes how to configure a scheduled task using the Windows 7 Task Scheduler which will run interactively with the user which is currently logged on.
If your workstations are connected to Active Directory you may consider configuring this using Group Policy Preferences.
In this example we will be configuring the ‘shutdown.hta’ application to run automatically at 6pm every day. The application provides a warning message, countdown and cancel button – so it is critical that it runs interactively so the user can see and interact with it. For more information on this application see: Windows 7 – Shutdown message with countdown and cancel.
How to create a scheduled task which runs interactively
Step 1: Set up the files
- Log into your Windows 7 workstation
- Install the Psexec tool – http://technet.microsoft.com/en-us/sysinternals/bb897553
- Save the application to the required folder (e.g. C:\. In this case, the application is called Shutdown.hta)
- Using notepad, create a new file with the following text. Save as C:\runtask.cmd
Step 2: Create the scheduled task
- Using the Start menu, type ‘Task Scheduler’
- Right click on the ‘Task Scheduler’ application and select ‘Run as administrator’
- Using the ‘Action’ pane select ‘Create Task’
- Under ‘Name’ enter an appropriate name (for example, “Shutdown at 6pm”)
- Click on the Change User or Group’button
- Enter the name of Users’ and click OK’
- Select the ‘Triggers’ tab
- Click on the ‘New’ button
- Enter in the appropriate time (for example, daily – 6pm)
- Click ‘OK’
- Select the ‘Actions’ tab
- Click on the New’button
- Under Program/script’enter sexec
- Under Add arguments’enter C:\runtask.cmd
- Click ‘OK’
- You can confirm the settings by right clicking on the new task and selecting ‘Run’
Step 3: Sit back and watch the magic
If setup correctly the application will run at the specified time (assuming the computer is turned on and a user is logged on). The application will appear on the screen for the logged on user.