I'm trying to have a progress bar AND create a log. When I run the following (only writes a progress bar), it runs perfect... but no log
robocopy $MyDocuments ($USB + "\Migrations\" + $PC + "\" + $Username + "\Documents") /s /e /Z /v /XJD /XJF /XF $ExclusionList | %{$data = $_.Split([char]9); if("$($data[4])" -ne "") { $file = "$($data[4])"} ;Write-Progress "Percentage $($data[0])" -Activity "Robocopy" -CurrentOperation "$($file)" -ErrorAction SilentlyContinue; }
If I add logging option
robocopy $MyDocuments ($USB + "\Migrations\" + $PC + "\" + $Username + "\Documents") /s /e /Z /v /XJD /XJF /XF $ExclusionList /LOG+:$LogfileRestore | %{$data = $_.Split([char]9); if("$($data[4])" -ne "") { $file = "$($data[4])"} ;Write-Progress "Percentage $($data[0])" -Activity "Robocopy" -CurrentOperation "$($file)" -ErrorAction SilentlyContinue; }
The progress bar show but it seems to be trying to show the progress of the log... the data copies correctly, the log is created correctly but the progress bar doesn't work correctly...
Is there a way to do both?
Jason Ostrowski