Running A Task In Different Workstation States

by Scott Robinet, in Tech Talk, posted 4/6/06

By default, an AutoMate Managed Task runs as the user that is currently logged onto the machine at the time the task is triggered, and will not run if the workstation is logged off or locked. But what if the task must run if there is or is not a user logged on? What if the task must run as a specific user, regardless of who is using the workstation when the task begins?

The answer to these questions, and many others that arise when it comes to the "user context" of a task, is the Managed Task's "Logon" settings, accessible on the Logon tab of the Managed Task's properties. These properties allow the task to behave differently depending on whether that workstation is logged on, logged off, or locked at the time of task triggering.

You can choose a specific user to "run" the task in the background, preventing any possible inference with the task while it is running. You can tell AutoMate to attempt to logon a specified user if the workstation is logged off, or attempt to unlock the workstation if it is locked before the task begins. You can even have a task run as a different user on the desktop!

Let's put this altogether into an example. Assume we must print a report at 2AM each morning. We build a task that opens our reporting application, sends the necessary keystrokes, and prints the report. We attach the Schedule Watcher trigger and configure it to trigger at 2AM each morning. But at 2AM, we're not entirely sure what state the workstation is going to be in. Users are supposed to log off the machine before they leave, but they forget to do that sometimes.

So the workstation could be logged on. Or it might be locked, because the workstation is set to automatically lock itself after 30 minutes of inactivity. It's even possible that a user may be on the machine at 2AM. Complicating matters, only the ReportMaster user can run the report!

Not to fear. AutoMate can handle all of these situations using the Logon properties. First, we need to take into account what should happen if a user is already logged onto the machine. In this situation, we still need to have the task run as ReportMaster. Setting the "When workstation is logged on" property to "Specified User" will handle this. Click the Specified User button and fill out the user information for ReportMaster. When the task runs our reporting application, it will think we are ReportMaster, even if Charlie is on the workstation at 2AM.

Next, set "When the workstation is logged off" to "Logon specified user". This will attempt to logon the workstation with the ReportMaster user if the workstation has been properly logged off. Finally, "When workstation is locked" should be set to "Unlock using specified user" if the workstation locked itself.
In this manner, the task will run in any of the three situations. Using this same methodology, you can fine tune the running of your task to take into account situations you may run into.
Happy AutoMating!