Windows 7 – Run Scheduled Task Interactively

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

  1. Log into your Windows 7 workstation
  2. Install the Psexec tool – http://technet.microsoft.com/en-us/sysinternals/bb897553
  3. Save the application to the required folder (e.g. C:\. In this case, the application is called Shutdown.hta)
  4. Using notepad, create a new file with the following text. Save as C:\runtask.cmd
C:\Shutdown.hta

Step 2: Create the scheduled task

  1. Using the Start menu,  type ‘Task Scheduler’
  2. Right click on the ‘Task Scheduler’ application and select ‘Run as administrator’
  3. WIndows7-InteractiveTask1
  4. Using the ‘Action’ pane select ‘Create Task’
  5. WIndows7-InteractiveTask2
  6. Under ‘Name’ enter an appropriate name (for example, “Shutdown at 6pm”)
  7. WIndows7-InteractiveTask4
  8. Click on the Change User or Group’button
  9. Enter the name of Users’ and click OK’
  10. WIndows7-InteractiveTask3
  11. Select the ‘Triggers’ tab
  12. Click on the ‘New’ button
  13. Enter in the appropriate time (for example, daily – 6pm)
  14. WIndows7-InteractiveTask5
  15. Click ‘OK’
  16. Select the ‘Actions’ tab
  17. Click on the New’button
  18. Under Program/script’enter sexec
  19. Under Add arguments’enter C:\runtask.cmd
  20. OK’
  21. WIndows7-InteractiveTask6
  22. Click ‘OK’
  23. 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.