Idempotent Powershell word search/replace across documents with headers, change tracking, etc

Posted by user61633 on Server Fault See other posts from Server Fault or by user61633
Published on 2011-01-11T15:08:00Z Indexed on 2014/06/02 9:31 UTC
Read the original article Hit count: 165

Filed under:
|

I've found one or two guides to doing a word search and replace across multiple documents with powershell. They work well on simple documents. However, the script ignores text in headers and footers; and if "track changes" is enabled, it replaces text which has already been replaced, resulting in multiple copies of the new text if I run the script more than once on the same file.

Any clues as to how I can avoid these undesirable behaviors and make this script robust?

© Server Fault or respective owner

Related posts about powershell

Related posts about ms-office