title: powershell move-item to a network folder doesn't work in windows 2012 task scheduler
body: <p>I have the following piece of PowerShell code:</p>
  
  <pre><code>$files = Get-ChildItem E:\Local_Files\Performance\*.txt -Recurse
  foreach ($file in $files) {
      (Get-Content $file.PSPath) |
      Where-Object { $_.Trim() -ne "" } |
      Set-Content $file.PSPath
  }
  
  Move-Item -Path E:\Local_Files\Performance\*.* -Destination E:\Local_Files\ -Force
  </code></pre>
  
  <p>It deletes empty rows for all files in a folder. Then, it moves any file on that folder to a second one. <code>Z:\</code> is a mapped network drive for a network folder. If I run the script in PowerShell, it works. When I schedule it in the Task Scheduler, it only works the first bit (the <code>Trim()</code> method).</p>
  
  <p>I have setup the same username to run the job in both cases. If I use a local folder as a target for move-item, it works in the Task Scheduler as well.</p>
  
  <p>Do you have any idea why it might not be working?</p>
  
  <p>I am on Windows Server 2012 R2.</p>
  
  <p>Many thanks, </p>