This script will let you deploy centrally managed Template files directly from SharePoint Online, using OneDrive and Intune.

The script needs only to be run once per user. Afterwards OneDrive takes over - Easy setup and management! :) /famousLastWords

Read the reason for this script here: https://www.iphase.dk/office-templates-in-the-cloud/

 

What this script takes care of:

  1. Syncronises central templates from a SharePoint Online Library, to the users windows device (read-only) using OneDrive.
  2. Instructs Office prgrams Word, Excel and PowerPoint to use the new location for personal templates
  3. Changes the default view when opening Word, Excel or PowerPoint, so the Templates are visible.

REMEMBER to place some actual TEMPLATE files in the sharepoint folders, ortherwise you will see nothing :)

POTX DOTX XLTX files only!

Look inside the script for comments and how to use it.

I have thorough inline documentation in this script!

 

In Sharepoint Online, please create a folder structure like this (Three folders at root level):

\Document Library\...

 ...\Word

 ...\Excel

...\PowerPoint

And put the respective templates in those folders.

 

Or you will need to change the last parts of the script to reflect your folderstructure:

 

 

PowerShell
Edit|Remove
# Word 
New-ItemProperty "HKCU:\Software\Microsoft\Office\$OfficeVersionCode\Word\Options" -Name "PersonalTemplates" -Value "$SyncPath\Word" -PropertyType ExpandString -Force -Confirm:$false 
New-ItemProperty "HKCU:\Software\Microsoft\Office\$OfficeVersionCode\Word\Options" -Name "officestartdefaulttab" -Value "1" -PropertyType DWord -Force -Confirm:$false 
 
# Excel 
New-ItemProperty "HKCU:\Software\Microsoft\Office\$OfficeVersionCode\Excel\Options" -Name "PersonalTemplates" -Value "$SyncPath\Excel" -PropertyType ExpandString -Force -Confirm:$false 
New-ItemProperty "HKCU:\Software\Microsoft\Office\$OfficeVersionCode\Excel\Options" -Name "officestartdefaulttab" -Value "1" -PropertyType DWord -Force -Confirm:$false 
 
# PowerPoint 
New-ItemProperty "HKCU:\Software\Microsoft\Office\$OfficeVersionCode\PowerPoint\Options" -Name "PersonalTemplates" -Value "$SyncPath\PowerPoint" -PropertyType ExpandString -Force -Confirm:$false 
New-ItemProperty "HKCU:\Software\Microsoft\Office\$OfficeVersionCode\PowerPoint\Options" -Name "officestartdefaulttab" -Value "1" -PropertyType DWord -Force -Confirm:$false