How do I use Tee-Object to send to file and console?

Ok, somehow my Google Photos got really messed up. I have duplicates upon duplicates of pictures and home videos. I’m trying to figure out how to deduplicate the pictures. I exported all the photos using google takeout. My plan is to deduplicate them, fix dates on them and then, delete all my photos and then upload the de-duplicated photos.

I have 500 10 GB files that I exported. It’s a lot of data. So, I wrote a script to extract all of the .zip files. But, I keep running into issues. It also appears that some .zip files are being skipped. I have a log file and the timestamps are sometimes 2 or 3 of these files in less than a minute. So, I’m trying to get verbose information sent to the file so I can see exactly what it did. I got that to work, but I want to also see it in console so I can check on it every so often rather than opening up the text file while it’s running.

Here is my script. Right now, it’s writing out the expand-archive only to console. I need it to also write to the text file.

$filepath = "G:\My Drive\Takeout\"

Get-ChildItem 'C:\users\David\desktop'

$filenames = Get-Childitem 'G:\My Drive\Takeout' takeout* | Sort Name

Write-Host "Start Date and Time " + (get-date).ToString()
foreach ($filename in $filenames) {
    $filepath
    $filename.name
    (get-date).ToString()

    Clear-Variable fullfilename
    Clear-Variable fileoutput
    Clear-Variable fulloutput

    $fullfilename = $filepath + $filename.name

    $fileoutput = $filename.Name + " Has started"
    Write-Host $fileoutput

    $fulloutput = (get-date).ToString() + " " + $fileoutput
    Write-Host "fulloutput is " + $fulloutput
    $fulloutput | Out-File -FilePath 'C:\users\David\desktop\log.txt' -Append
    

    Expand-Archive $fullfilename 'G:\My Drive\Takeout Extracted' -Verbose | Tee-Object -FilePath 'C:\users\David\desktop\log.txt' -Append

    
    Clear-Variable fullfilename
    Clear-Variable fileoutput
    Clear-Variable fulloutput

    $fileoutput = $filename.Name + " Has completed"
    Write-Host $fileoutput

    $fulloutput = (get-date).ToString() + " " + $fileoutput
    Write-Host "fulloutput is " + $fulloutput
    $expandoutput | Out-File -FilePath 'C:\users\David\desktop\log.txt' -Append
    $fulloutput | Out-File -FilePath 'C:\users\David\desktop\log.txt' -Append
    #remove-item $filename.FullName
}

Well, I changed the script so it’s only exporting the verbose information for extract-archive to the text file. I’m still getting the start and stop time of each itteration of the loop to console and the text file. I think I’ll leave it this way. Probably better anyways. This way I can see start and stop times quickly while it runs for the next week or so and see if a start and stop is too quick… if I find it, i’ll open the log file to see what happened at that moment.

Still would be nice to know why this doesn’t work though.