Error Accessing UNC through remote machine

I’m running PowerShell as a domain administrator on my local PC

Invoke-Command -ComputerName $computer -ScriptBlock {Copy-Item -Path ‘\fileshare\folder\filename.txt’ -Destination 'C:\temp'}

I get the following errors

Access is denied

  • CategoryInfo : PermissionDenied: (\fileshare\folder:String) [Copy-Item], UnauthorizedAccessException
  • FullyQualifiedErrorId : ItemExistsUnauthorizedAccessError,Microsoft.PowerShell.Commands.Copy-ItemCommand
  • PSComputerName : test

Cannot find path ‘\fileshare\folder’ because it does not exist.

  • CategoryInfo : ObjectNotFound: (\fileshare\folder:String) [Copy-Item], ItemNotFoundException
  • FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.Copy-ItemCommand
  • PSComputerName : test

If I try the copy-item command on the server directly it works fine, no errors. Why do I get the errors when I try to run from my PC?

The old Kerberos double hop may be your issue:

In your case, whatever “server” hosts the fileshare would be Server C