File Copy Access is denied

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of H Man H Man 2 years, 4 months ago.

  • Author
    Posts
  • #17797
    Profile photo of H Man
    H Man
    Participant

    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
    Profile photo of Don Jones
    Don Jones
    Keymaster

    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
    Profile photo of H Man
    H Man
    Participant

    Thanks Don

You must be logged in to reply to this topic.