0

I executed this copy-item command line on windows 11:

Copy-Item -Path '//c/shared/file.xml' -Destination '\\REMOTE-PC\c$\testFolder' -Force 

and It gives me unauthorized access message.

enter image description here

My user has full control and the same line command is working in Windows 10. Something changed in the new version of Windows. Any idea?

Error Message:

Copy-Item : Access is denied At line:1 char:1 + Copy-Item -Path '//source-Pc/shared/file.xml' -Destination '\dest-pc\c$ ... +

+ CategoryInfo : NotSpecified: (:) [Copy-Item], UnauthorizedAccessException + FullyQualifiedErrorId :
System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.CopyItemCommand
Primoshenko
  • 140
  • 1
  • 9
  • May be double hop authentication issues – TheGameiswar Dec 27 '21 at 14:09
  • Try one of this : https://stackoverflow.com/questions/612015/copy-item-with-alternate-credentials – TheGameiswar Dec 27 '21 at 14:10
  • please post the FULL error msg _as text_. why? lookee ... Why not upload images of code/errors when asking a question? - Meta Stack Overflow — https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-errors-when-asking-a-question – Lee_Dailey Dec 27 '21 at 18:33
  • Sorry my bad. Here is attached the error message as text. – Primoshenko Dec 27 '21 at 19:17
  • Please update your post with the error, not in the comments, properly formatted. This doesn't seem like a PowerShell issue. I would suggest asking on [Super User](https://superuser.com/). Seems like a permissions issue. Is the shell elevated? Can you copy the file locally? Can you copy it to any other PC? Those are the type of questions I have just by looking at this. – Abraham Zinala Dec 27 '21 at 19:26
  • Why `-Recurse` if you are copying a single file? Also, why different slashes in source and destination? Are you trying to copy a file from one remote location to another? Does `Get-Content '//c/shared/file.xml'` work? – n0rd Dec 27 '21 at 20:22
  • Thanks for your feedback, Yes I can copy the file locally and using a windows explorer as well. I can use the same copy-item line code to other pcs with Windows 10 or lower versions. – Primoshenko Dec 27 '21 at 20:23
  • Yes, I am trying to copy a file from a remote server to a remote workstation. -Recurse is used for multiple files but I tried to simplify the issue in only one command. – Primoshenko Dec 27 '21 at 20:26

0 Answers0