I'm a Powershell rookie and I would like to pipe the result of Compare-Object to a Write-Progress function (progress bar) as well as a .csv file. I have the following, but it only writes to the file. Can I only use a single pipe? I have large directories to compare and really don't want to loop over the results again after using Compare-Object:
$Counter = 0
Write-Host "Comparing Folders"
compare-object $dirList1 $dirList2 | %{
Write-Progress -Activity "Comparing Folders" -Status "$_" -PercentComplete ($counter/$TotalFolderCount * 100)
sleep -milliseconds 20
$Counter++
} | ft inputobject, @{n="Only In Directory";e={ if ($_.SideIndicator -eq '=>') { "$dir2" } else { "$dir1" } }} | Out-File $outFile