• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2226
  • Last Modified:

Get Word Document contents into variable with Powershell

I am looking for a way to get a Word Documents contents into a powershell variable. Ideas?
0
Blowfelt82
Asked:
Blowfelt82
1 Solution
 
Barry CunneyCommented:
$word = New-Object -comobject Word.Application
$word.Visible = $True
$doc = $word.Documents.Open("C:\Scripts\Test.doc")
$body_content = $doc.Paragraphs.Range.Text
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Building an Effective Phishing Protection Program

Join Director of Product Management Todd OBoyle on April 26th as he covers the key elements of a phishing protection program. Whether you’re an old hat at phishing education or considering starting a program -- we'll discuss critical components that should be in any program.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now