I have two computers, both windows 64-bit machines. Call the local computer machine A and the remote computer machine B. I have a script.py
file on machine A. Without leaving machine A, I want to:
- Copy
script.py
onto machine B; - Run
script.py
on machine B; - Get the output on machine A.
I'm having problems with step 1.
Steps 2. and 3. are solved already.
I've configured both computers so that I can successfully run from PowerShell6 Invoke-Commands. The PSSessions established between machine A and B are functional. I can successfully run a script.py
that is on machine B from machine A:
Enter-PSSession -hostname $hostname -username pshell
-ScriptBlock{c:\Users\pshell\Anaconda3\python.exe script.py};
and get the output back to machine A.
However, I don't know find the commands to copy script.py
from machine A to machine B. I think it's a relatively easy task but I can't find the relevant commands. Any indications/suggestions not including third-party software/packages are welcome.