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 }