How to Change MS Word Template - Headers with Powershell

markpalinux used Ask the Experts™
I have a problem that I am trying to use Powershell to resolve.
It has to do with MS Word Office templates used as headers. File servers were changes and the old UNC path no longer exists.

Microsoft gave examples for VBA and VBscript how to make changes, however I cannot find these properties with Powershell,
I tried to look at the Office Object Model and use powershell's Get-Member but could not figure things out.

I am aware that DNS and an Alias can change things but for security we have strict name checking in place.

Documents that have attached templates take a long time to open in Word 2002 and in Word 2003

Here are the lines I am referring to.
  Set objDoc = Documents.Open(strFilePath & strFileName)    
         Set objTemplate = objDoc.AttachedTemplate    
         Set dlgTemplate = Dialogs(wdDialogToolsTemplates)    
         strPath = dlgTemplate.Template    

So far I have:
$Document = "C:\Temp\Donation Form.doc"
$Word = New-Object -comobject Word.Application
$OpenDoc = $Word.Documents.Open($Document)
$objTemplate = $OpenDoc.AttachedTemplate
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Manager, Document Services Center
Top Expert 2004
So you are trying to re-attach a template to all your documents?  I'm not clear on exactly what you need.  Not familiar with PowerShell but see if this helps at all:
Joanne M. OrzechManager, Document Services Center
Top Expert 2004

Excellent.  Thank you.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial