Can't map a drive through PSsession

This topic contains 2 replies, has 2 voices, and was last updated by  Poseyj 2 years, 8 months ago.

  • Author
  • #30707


    So I have two servers. I'm a domain admin. I start a psm1 on Server1 which creates a pssession to Server2 so it can map a drive back to Server1 and exchange files.

    Only problem is I get this error:

    New-PSDrive : Drive root "\\server\folder" does not exist or it's not a folder.

    I can go on the machine, run the same exact command and it maps just fine. The path is definitely valid.

    Also I can try any other Server, Server3 and Server4, they both can't connect through the pssession. But at the machine's powershell console, everything works. Any ideas?

    function Server2_SQL_Backup 
        $Server2Session = New-PSSession -ComputerName Server2
        invoke-command -session $Server2Session -scriptblock `
            New-PSDrive –Name X –PSProvider FileSystem –Root "\\Server1\users" 2>&1 | tee -filePath "D:\PS\error_results.txt"
            Get-ChildItem "X:\" | out-file "D:\PS\directory_listing.txt"
        } -AsJob -JobName ArenaSQLBackupJob
  • #30708

    Don Jones

    Double-hop. You delegate your credential to Server2, which cannot then delegate it further – including back to the server it came from. See

  • #30710


    Ohhh I see ok, Well that makes sense. Thanks.

You must be logged in to reply to this topic.