How to install Word and LibreOffice templates with a login script on Windows Server

Document Template ImageAfter some research and experimentation, I finally figured out how to push out Word and LibreOffice templates to client computers on a Windows Domain using a few commands in a login script. In our environment, we have a mix of Microsoft Office 2007, Microsoft Office 2010, and LibreOffice 4.x.x. This method seems to work with all three.

To start with, I placed the template files (.dotx and .ott) in a subfolder named templates and placed that within the netlogon folder on the domain controller. That way they are available for copying by the login script.

Here are the lines I added to the login script:

xcopy "\\server\netlogon\templates\Invoice Template.dotx" "%appdata%\microsoft\Templates\" /y
mkdir "%appdata%\LibreOffice\4\user\template"
xcopy "\\server\netlogon\templates\Invoice" "%appdata%\LibreOffice\4\user\template" /y

Both destination folders use the %appdata% variable which should work in all modern versions of Windows. The destination folder referenced in the first line is already created when MS Office is installed, so the script just copies the template. The second two lines are for LibreOffice. Since the user templates folder is not created automatically, we first issue a command to create it (this line will harmlessly error out once the folder is already there) and then copy the template.

I’m still testing this in our environment, but it seems to be working well so far. I’ll update and edit this post if/when I notice any problems.