Find all documents with "Track changes" using PowerShell
One of our customers was wandering if it is at all possible to find, using PowerShell, all documents in a specific folder that have "Track Changes" activated.
This is what I came up with, and it works well:
function FindTrackRevisions ([string] $path) {
$files = Get-ChildItem $path -Filter "*.doc"
$results = @{};
$wa = New-Object -ComObject Word.Application
$wa.Visible = $false $files | % {
$filePath = $_.FullName
$wd = $wa.Documents.Add($filePath)
Write-Host "Loading $filePath..."
$results[$filePath] = $wd.TrackRevisions
}
$wa.Quit()
$wa = $null
$results | ft -AutoSize
}