title: Find with powershell the Last Saved By of word and excel documents
body: <p>I have a folder with sub folders and I want to run a powershell script that finds all the office documents (word and excel 2003,2007 and 2010 for the moment) and print the "last saved by" property that we can find on the properties, details tab of the files.</p>
  
  <p>Can anybody help?</p>
  
  <p>--- solution ---</p>
  
  <pre><code>$word = New-Object -Com Word.Application
  $word.Visible = $false #to prevent the document you open to show
  $doc = $word.Documents.Open($path)
  
  $binding = "System.Reflection.BindingFlags" -as [type]
  Foreach($property in $doc.BuiltInDocumentProperties) {
     try {
        $pn = [System.__ComObject].invokemember("name",$binding::GetProperty,$null,$property,$null)
        if ($pn -eq "Last author") {
           $lastSaved = [System.__ComObject].invokemember("value",$binding::GetProperty,$null,$property,$null)
           write-host "Last saved by: "$lastSaved      
        }        }
     catch { }
  }
  
  $doc.Close()
  $word.Quit()
  </code></pre>
  
  <p>Did some adjustments to the correct answer and now it's working.</p>