Views:

A BPA task that creates Microsoft Word documents using the Word Merge Tool is failing without producing any documents. The BPA Event Log for the task has the following error: "Microsoft Word could not initialise properly". 

Cause

The account under which the Advance BPA Server service runs, which the tasks also run as, does not have adequate rights to run the DCOM components of a Word document.

Resolution

Change the account that the Word DCOM components run as to an account with administrator privileges using dcomcnfg.

Click on Start -> Run (or press the Windows Key + R) to bring up the Run dialog,  For Windows 8+ or Server 2012+, right-click at the very bottom left of the screen (the lower-left hover-point that normally brings up the start menu) to bring up the context-menu and select Run.

Type dcomcnfg and press Enter.

This brings up the Component Services dialog. Expand Component Services, then Computers, and then My Computer, and finally DCOM Config.

Scroll down to find the entry for the Microsoft Office Word Document, the name of this entry will depend on the version of Microsoft Word installed on the machine.  Once the entry has been found, right-click on it and select Properties.

When the properties dialog pops up, select the Identity tab, then select the This User radio button and enter an administrator username and password.

Click OK and then close Component Services.

The BPA task should run correctly.

NOTE: THIS SOLUTION HAS WORKED FOR ALL CLIENTS, EXCEPT TWO: William Buck Victoria and Lever Business Accountants (private cloud).

In these cases the above solution did not work, and DCOM had to be set up as "Interactive User".

WARNING: Setting Word to use the interactive user requires a user to be logged in to the server at all times for Word to initialise properly, which because it's a SERVER, is not usually the case.

The reason a user has to be logged in is that disconnecting from an RDP session causes services Word depends upon to terminate.

So, try the ABOVE solution FIRST, and if it does not work, then try setting DCOM to "Interactive User". 

Security Configuration for ‘INTERACTIVE’ user

Under the Security tab give the INTERACTIVE user Local Launch, Local Activation and Local Access permissions. Also in the Identity tab ensure the option The interactive user has been selected.

 

WARNING: WHEN USING "Interactive User", THE FOLLOWING PROCESS IS REQUIRED WHEN LOGGING OUT:

To disconnect from an RDP session without locking the screen and terminating services, you first need to know the name of the session (login instance) you are in.

This is found by running the "query session" command in a command prompt.

The command prompt muist be Run As Administrator to execute the command to disconnect.

Search for CMD.exe, and then right-click on it and select "Run as administrator". 

In the command prompt, enter the following command:

query session

Your session name is indicated by the ">" character, E.g.:

Once the session name has been found, run the following command in the command prompt:

tscon <sessionname> /dest:console

E.g.:

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

I have written a batch-file encapsulating the above commands, linked here:

LogoffAndStayRunning.bat

Save this file somewhere on the path of the target server.

WARNING: A server restart will leave no-one logged in, so Word will fail to initialise.

The one client above used Autologon For Windows to automatically log in the required user on server startup.  This can be downloaded from Microsoft.  The following link was current at publication:

https://docs.microsoft.com/en-us/sysinternals/downloads/autologon

Autologin Version 3.10 is attached to this article as an object, but check for a later version.

WARNING: This auto-logged-on user is replaced when an RDP session logs in, so the special disconnection process above is still required after RDPing to the server.

AutoLogon.zip
 

Related Products: APS Business Process Automation