troubleshooting Question

How to Change MS Word Template - Headers with Powershell

Avatar of markpalinux
markpalinuxFlag for United States of America asked on
Microsoft WordVB ScriptPowershell
3 Comments1 Solution2645 ViewsLast Modified:
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
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros