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
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?
$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
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/.
Ohhh I see ok, Well that makes sense. Thanks.
The topic ‘Can't map a drive through PSsession’ is closed to new replies.