Can't map a drive through PSsession

Welcome Forums General PowerShell Q&A Can't map a drive through PSsession

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

3 years, 5 months ago.

  • Author
  • #30707

    Points: 0
    Rank: Member

    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

    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

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

  • #30710

    Points: 0
    Rank: Member

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

The topic ‘Can't map a drive through PSsession’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort