I'm trying to execute a powershell script located at a remote machine using the below command and it works great
invoke-command (powershell c:\install\install.ps1) -computername box1 -credential (get-credential)
The above script in-turn copies files from a network share (using robocopy) - It fails complaining the location doesn't exist. Found out it was due to permission issue. It works when I explicitly mentioned in the script to use the following credentials for the share
net use \share1\files password /user:username
Is there a way to pass in the same credentials used to run the script to be used by the script to access other resources in the remote machine?
Thanks! Sanjeev