Reputation: 1034
I am running command to copy a file from shared location to the local machine.
Command is Copy-Item '\\ServerName\share\Setup\Setup.msi' 'C:\Windows\Temp\RiversandSetup'
This command is works fine when I run it from Server1. But when i run same command from remote machine by opening a session it fails with error 'Cannot find path 'SharePath' because it does not exist.'. Command is $sessions = New-PSSession -ComputerName RemoteServerName
Invoke-Command -session $sessions -ScriptBlock {Copy-Item '\\SharePath\share\Setup\Setup.msi' 'C:\Windows\Temp\RiversandSetup'}
Please advice.
Upvotes: 1
Views: 3498
Reputation: 10107
You are most likely running into an issue with double-hop authentication. This could help but it depends on your environment:
Setting up CredSSP properly for powershell multi-hop issue
Upvotes: 2