I wanted to know if there's an easy way to log all successful transferred items to a .txt file. I would like to create the .txt file and list all the files that are being transferred and updating it afterwards if it is used again (like on robocopy / log+)?
Current:
$loc1 = "C:\Users\user1\Documents\test2\*"
$loc2 = "C:\Users\user1\Documents\test2"
Move-Item $loc1 $loc2 -force
Use -PassThru at the end of Move-Item. It will return a FileInfo object (same as returned by Get-ChildItem) for each item moved:
$itemsMoved = Move-Item test.* E:\Scratch\t2 -PassThru
$itemsMoved | Select-Object FullName | Add-content c:\temp\copy.log