File Copy Access is denied

Welcome Forums General PowerShell Q&A File Copy Access is denied

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
4 years, 3 months ago.

  • Author
    Posts
  • #17797

    Participant
    Points: 0
    Rank: Member

    I am trying to copy a file to multiple remote computers thru a pssession.

    I am getting an Access is denied error

    All the users have perms to acess the file share

    heres the code i am using

          
    $NewWrk = Get-QADComputer | ?  whenCreated  -gt 8/05/2014
    $s = new-PSSession -computername ($NewWrk |  select -ExpandProperty name)  -ErrorAction SilentlyContinue
    
    
    Invoke-Command -Session $s  -ScriptBlock { 
    
    copy-item -Path '\\file01\ec\ITMigration\Agent.jnlp'  -Destination "$env:USERPROFILE\Desktop" 
    
    }
    
    

    is this the 3rd hop issue? any work around with Enable-WSManCredSSP?

    thank you

  • #17799

    Keymaster
    Points: 1,638
    Helping HandTeam Member
    Rank: Community Hero

    It's actually called the "second hop" issue, and yes, that's the problem. You're asking the remote machine to go to a UNC; it has no credentials to present. And yes, CredSSP would be one way to address the problem, as outlined in "Secrets of PowerShell Remoting."

    You could also modify the share permissions to accept non-authenticated (anonymous) connections. That's different from "Everyone" or "All users."

  • #17801

    Participant
    Points: 0
    Rank: Member

    Thanks Don

The topic ‘File Copy Access is denied’ is closed to new replies.