Symptom #
An automated task containing a Run Microsoft Word (Merge) 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.
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.