Author Posts

October 12, 2015 at 4:28 pm

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

    

}

October 12, 2015 at 4:50 pm

Double-hop. You delegate your credential to Server2, which cannot then delegate it further – including back to the server it came from. See https://powershell.org/kb/the-double-hop-authentication-problem/.

October 12, 2015 at 5:03 pm

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