title: Powershell Copy-item not working for unc paths
body: <p>I am trying to sync two directories over the network between servers using UNC paths. The files are 20+ GB. I wrote a Powershell script to compare two directories and then copy any files missing from one to the other. However this doesn't appear to work.
  Once the script is run it finds the files properly but when it tries to copy them it appears that the files are instantly copied (which is impossible). Even though the files take up 20+ GB of space on the hard drive they don't contain any data.</p>
  
  <pre><code>$SERVER1 = "SERVER1"
  $SERVER2 = "SERVER2"
  $VDISKPATH = "e$\vdisks"
  
  #Automatically get vDisks and pvp files in VDISKPATH folder
  $FILES1 = Get-ChildItem -Path \\$SERVER1\$VDISKPATH\* -Include *.vhd,*.pvp
  $FILES2 = Get-ChildItem -Path \\$SERVER2\$VDISKPATH\* -Include *.vhd,*.pvp
  
  if ( $FILES1 -and $FILES2 ) {
      $DIFF = Compare-Object -ReferenceObject $FILES1 -DifferenceObject $FILES2 -Property name, length
  }
  
  # Copy all of the missing files from 
  if ($DIFF) {
      $DIFF | Where-Object { $PSItem.SideIndicator -eq "&lt;="} | ForEach-Object {
      Copy-Item "\\$SERVER1\$VDISKPATH\$($_.name)" -Destination \\$SERVER2\$VDISKPATH
      }
      $DIFF | Where-Object { $PSItem.SideIndicator -eq "=&gt;"} | ForEach-Object { Write-Host "Copying $($_.name) to $SERVER1" |
      Copy-Item "\\$SERVER2\$VDISKPATH\$($_.name)" -Destination \\$SERVER1\$VDISKPATH
      }
  Write-Host "All file copies have finished!"
  }
  else {
      Write-Host "All files are equal"
      Compare-Object -ReferenceObject $FILES1.name -DifferenceObject $FILES2.name -IncludeEqual
  }
  </code></pre>
  
  <p>Typically the file copy (if done manually) takes about 15 minutes. I let the script run for 90 minutes and it never finished. Can someone help me figure out why the files are not coping properly?</p>