I'm writing a script that uses invoke-command to run some operations on a remote system. I need to copy a file from a server to the remote system.
When invoking the command on a remote system i'm unable to copy a file from a UNC path to the system that is being remoted into.
From the local host that is running the script not from a remote session I can copy the UNC path fine. Is it possible to call a function from an invoke-command script block to copy the file that is on a UNC path from the local host and then once that's done return back into the script block to continue to process the commands on the remote host?
function CopyUNC($host){
}
invoke-command -computername powershell-xp2
{
copy-item \\sbs\downloads\file.exe C:\repository
#^ this fails, I read because of authentication
#trying to do something like
$computer = hostname
CopyUNC($computer)
}
Thanks!
Zach