Robocopy Access Denied Error 5 From Powershell

1

I am copying files from my build server to a web server on Windows Server 2016. I am running the following from PowerShell. I am running this script with an administer account which has read/write access to the destination directory.

robocopy $Path\Items $_\Items /Sec /copy:DT /MIR /NDL /NS /NP /MT /w:1 /r:1 /R:20 2>&1 | out-host

I get the following error

ERROR 5 (0x00000005) Creating Destination Directory \SOMEPATH\Data\Items\ Access is denied.

powershell
robocopy
asked on Stack Overflow Jun 14, 2019 by MicroMan • edited Jun 14, 2019 by mhu

1 Answer

2
  • Ensure that you open your powershell session as an administrator (runas)
  • Also check the NTFS permission on the destination path and not only the security permissions.
  • If you are using a DFS path you should be better with the UNC path of the actual servername.

Hope this helps.

Actually I was not able to post this as a comment under your question, because I don't have 50 rep points yet.

answered on Stack Overflow Jun 14, 2019 by Robin

User contributions licensed under CC BY-SA 3.0