AutoMate and Terminal Services

Terminal Services, renamed as Remote Desktop Services from Windows Server 2008 R2 onwards, is one of the components of Microsoft Windows (both server and client versions) that allows a user to access applications and data on a remote computer over a network. Terminal Services is Microsoft's implementation of thin-client terminal server computing, where Windows applications, or even the entire desktop of the computer running terminal services, are made accessible to a remote client machine. Once installed and enabled, these services allow a single computer to host multiple simultaneous user sessions. Terminal Services consists of two components:

When a single RDP client connects to a remote server, it is tagged with a unique SessionID and associated with a freshly spawned console session (session 0). The login subsystem (winlogon.exe) and the Graphics Device Interface (GDI) subsystem, which handles the job of authenticating the user and presenting the GUI are loaded in a new session, rather than the console session. When creating the new session, the graphics and keyboard/mouse device drivers are replaced with RDP-specific drivers.

If another RDP client connects to the same remote server while the original session is still connected, the second connection is tagged with a unique SessionID as well. However, this session is not associated with session 0 (because the first RDP client is currently using session 0). Although each session has its own desktop, they all share the same set of system services and resources. Since AutoMate is a system-based software service as opposed to a user-based software application, there are a few important issues to be aware of when using AutoMate in a Terminal Services / Remote Desktop environment.

Console vs. Remote Session

In a Terminal Services / Remote Desktop environment there are two types of sessions. AutoMate behaves differently depending on what type of session it is running in.

Console Session:

A console session is a traditional windows session that occurs as a result of logging onto the physical machine. AutoMate is capable of functioning normally when being used from the console. Tasks can be edited, created, deleted and run. The tasks will run on the current session.

Remote Session

A windows session on a Terminal Services enabled computer takes place from a remote location using RDP. When running under a Remote session, AutoMate operates differently. The AutoMate service can only run on the console session. When a task is triggered or run by an Agent, it will run on the console session (because that is where the service resides). If a managed task triggers or is run from the Task Administrator, however, the task will run on the console and not the remote desktop. This is mainly due to the fact that winlogon.exe and the GDI subsystem are loaded in a new session, rather than the console session. In other words, during a single remote session, tasks may run but you may not see them running unless you are physically in front of the server where task execution takes place.

In the case where more than one RDP client is connected to the server, tasks will fail to run due to the fact that AutoMate cannot detect the console (session 0) in order to execute the task. A task will not trigger as a result of conditions on a remote session. For example, the Key Watcher trigger will not trigger a task as a result of keystrokes typed during a remote session. Additionally, the Window Watcher trigger will not trigger as a result of open windows on a remote session. Only the console session is monitored for trigger conditions.

Tasks can be edited, created and executed using the Task Builder because the Task Builder is a separate executable application that does not rely on the AutoMate service. Another way to solve this issue would be to use remote control software that logs the user directly onto the console of the remote machine (i.e. VNC or PCAnywhere).

See Also

Introduction to AML

Window Dissection Parameters

About Windows Foreground Timeout

Optimizing Task Execution Speed