File transfer over WAN link causes corruption

569 views Asked by At

I'm running into an issue with PDF files becoming corrupted on copy from one WAN location to the next.

I have a PowerShell script (code below) that runs nightly to copy a PDF file by Windows Task Scheduler, sometimes two, from a satellite office in Florida to our corporate network in Oregon. These files are generally around 35 Megs, but have been seen as large as 65 Megs. The files are generated fine at the satellite location, but after the copy script runs at night, the file becomes corrupted and will not open.

Is there something I can do in the script to include some type of error correction to ensure the file doesn't corrupt? Is there a better tool to use where I can ensure file transmission and maintain the integrity.

I'm not married to any solution just as long as I can automate the process and only copies the files generated that day.

Thank you for your help. David

PowerShell Script


$SourcePath = "\\Satellite\packingslips"
$RemotePath = "\\Corp\Shared\Packing_Slips\Satellite"

$Curr_date = get-date
$Max_days = "-1"


Get-ChildItem $SourcePath |
    Where-Object {($_.LastWriteTime.Date -ge ($Curr_date.addDays($Max_days)).Date) -and ($_.LastWriteTime.Date -le $Curr_date.Date)} |
    Copy-Item -Destination $RemotePath

Don't laugh at my code. It's not my strong point.

1

There are 1 answers

1
Simon Catlin On

Agree with TessellatingHeckler - I'd look at your error rates on your WAN interfaces...

However, I also agree that RoboCopy is a good way forward:

robocopy \\Satellite\packingslips \\Corp\Shared\Packing_Slips\Satellite *.pdf /minage:1 /log:<path_to_logfile>