# Access denied copying files in remote session

**URL:** <https://forums.powershell.org/t/access-denied-copying-files-in-remote-session/1175>\
**Category:** PowerShell Help\
**Created:** [December 31, 2011, 6:30pm UTC](https://forums.powershell.org/t/access-denied-copying-files-in-remote-session/1175 "2011-12-31T18:30:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![archives](https://avatars.discourse-cdn.com/v4/letter/a/bb73d2/32.png) [@archives](https://forums.powershell.org/u/archives)\
**Post date:** [December 31, 2011, 6:30pm UTC](https://forums.powershell.org/t/access-denied-copying-files-in-remote-session/1175/1 "2011-12-31T18:30:00Z")

</div>

by jhenke at 2013-04-02 11:22:26

> I have on a server that I want to copy to another network share.  
>   
> If I manually RDP to that server I can execute this copy using powershell copy-item.  
>   
>   
> Taking this a step further, I want to use remote sesssions to loop through many servers and copy this file to the network share.  
>   
> To accomplish this, I created a script to read a list of servers. From there, I establish a remote session using the same administrative ID I used for the manual test. I confirmed that I am able to loop through the servers and establish a remote session by returning the computer name of each server. So far so good.  
>   
> However, when I try to execute the copy-item command - the same one I used for the manual test, with the same ID it returns Access is denied (pointing to the destination share - again the same one that works manually from any of these servers.)  
>   
> In troubleshooting this, I established a remote session interactively, taking my script out of the equation.  
>   
>   
>   
> $cred=get-credential -credential "we\xxinstsap"  
> $sSID = "SME"  
> $sHost = "sapsm-xavw90"  
> $RS = new-pssession -name $sSID -computername $sHost -credential $cred  
> enter-pssession $RS  
> Copy-Item $sourcefile $destdirectory  
>   
> I have tried literal paths instead of variables, but either way, it returns Access denied. Again, this works if I run it from the server. So, this appears to be an issue with the remote session.  
>   
>   
> If anyone has any suggestions, I would be be very greatful!  
>   
> thanks,  
>   
> Jeff Henke

by DonJ at 2013-04-02 11:29:17

> This is a classic "second hop" issue resulting from a default inability to use your delegated credential for further network access. You will typically need to enable CredSSP. See "Secrets of PowerShell Remoting" at [PowerShellBooks.com](http://PowerShellBooks.com).

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 9:03pm UTC](https://forums.powershell.org/t/access-denied-copying-files-in-remote-session/1175/2 "2024-05-16T21:03:30Z")

</div>


