title: TFS Release, running PowerShell, cannot create DtlDownloads
body: <p>I am trying to get some automatic deployments up and running using TFS 15 (on-premise). I have a powershell script on the deployment target to call.</p>
  
  <p>The deployments starts fine by downloading the artifact. But when the agent runs the script it wants to create a folder <code>C:\Windows\DtlDownloads</code> (thats not part of my script but part of preparing things for TFS I guess). That fails:</p>
  
  <pre><code>##[debug]System.AggregateException: Failed to install 'VisualStudioRemoteDeployer20597940-38b2-4ba8-9a4d-fcc894308730' from service executable path VisualStudioRemoteDeployer.exe . Consult the logs below:
  Access to the path 'DtlDownloads' is denied.
  CategoryInfo :PermissionDenied: (C:\Windows\DtlDownloads:String) [New-Item], UnauthorizedAccessException
  FullyQualifiedErrorId :CreateDirectoryUnauthorizedAccessError,Microsoft.PowerShell.Commands.NewItemCommand 
  </code></pre>
  
  <p>The user used to logon is a server-local user named <code>deploy</code> who is also a local administrator on that machine. I also checked the <em>effective access</em> for that user on the windows folder and it should be able to create directories.</p>
  
  <p>Something similar happens with the copy step. Robocopy signals two errors:</p>
  
  <pre><code>2017/03/16 08:57:21 ERROR 5 (0x00000005) Getting File System Type of Destination \\server.domain.com\c$\abc\def\ 
  Access is denied.
  </code></pre>
  
  <p>and </p>
  
  <pre><code>2017/03/16 08:57:21 ERROR 5 (0x00000005) Creating Destination Directory \\server.domain.com\c$\abc\def\ 
  Access is denied.
  </code></pre>
  
  <p>The second is a bit unexpected as the folder <code>def</code> already exists but I guess it is a follow up because getting the type failed beforehand.</p>
  
  <p>The user itself must have been recognized because I get different errors when using invalid credentials. I have enabled WinRM using <code>Enable-PSRemoting</code> and <code>ConfigureWinRM.ps1</code> from <a href="https://github.com/Microsoft/vsts-rm-documentation/tree/master/WinRM/WinRM-Http-Https-Without-Makecert" rel="nofollow noreferrer" title="WinRM-Http-Https-Without-Makecert">WinRM-Http-Https-Without-Makecert</a>.</p>
  
  <p>What could still restrict the permissions?</p>
  
  <hr>
  
  <p>Update: Using a domain user instead of a local one of that server solves the issue. But I do not understand why. Can someone explain or even provide information how to make it work with a local user?</p>