$word = New-Object -ComObject word.application
$word.visible = $false
$pages = 0
try {
 Get-ChildItem -path "." | ? {$_.name -match ".*\.docx{0,1}$"} | foreach-object {
  write-host $_.name
  # fullName, confirmConversion, readOnly, addToRecent, passwordDocument
  $doc = $word.documents.open($_.fullname, $false, $true, $false, "")
  $window = $doc.ActiveWindow; $panes = $window.Panes; $pane = $Panes.item(1)
  $pages += $pane.pages.count
  $doc.close()
  write-host $pages
 }
} finally { $word.Quit() }