Tasks with Merge MS Word Document steps are failing to run – Error – “Word cannot initialise”

Symptom

An automated task containing a Merge MS Word Document step is failing to run at the scheduled runtime. However, if the task is run manually then it executes as normal.

The following error may appear in the TaskCentre event log:

Word cannot initialise

Cause

This is linked to an issue caused by the disconnect of a Remote Desktop session.

If the user administers TaskCentre remotely, the command sent by Remote Desktop to disconnect from the session locks the screen. This act also causes certain services to terminate which Microsoft Word relies on for automation. This in turn prevents Microsoft Word from initialising when TaskCentre requires a Word merge.

Note: This issue does not occur if the user connects to the machine via the Console. The screen may be locked as normal when disconnecting and any Word merge tasks will complete successfully at their scheduled runtimes.

Resolution

For Remote Desktop sessions, run the following command when disconnecting.

This will prevent the screen from locking and leave the interactive user working which will allow Word merge to continue.

tscon sessionid /dest:console

Where sessionid is your current session ID or session name of the Remote Desktop connection.

To obtain your session ID, use the command query session. The session ID will be identified by the greater than symbol ‘>’ under the SESSIONNAME column.