I have a scenario I'm trying to work out in my mind and I'm struggling to find a way to make it work using PowerShell and I'm not sure I have all the pieces in my mind. I want to send a command to another computer and have it retrieve files from a different computer. So something like this:
A ↦ B ↔ C
Computer A sends the command/code/session/job and all necessary information to Computer B.
Ideally, Computer A disconnects and isn't necessary for any further part and shouldn't be involved in the file transfer.
Computer B reaches out to Computer C and retrieves the files specified by any method.
I'm really not sure where to concentrate my thoughts on this. I'd like to do this with a PSSession but it also seems like its possible to do this as a job but I'm not familiar with jobs and only partially familiar with PSSessions.
What are some of the prerequesites I need to make a script like this work and what do you think is the best way to do this?
I am running this from Windows 10 and PowerShell v5.1
Do you know about copy-item and -fromsession and -tosession options?
1 way would be just to have a script on computer B that does everything it requires. You then just execute the script using
invoke-command -ComputerName 'Computer B' -filepath C:\TheScript.ps1
from Computer A?
I'd like for the process to pass on the variables I pick (computernames and usernames, etc). Any clue how to pass that easily?
Hello, maybe this can help,
New-PSDrive -name "destination" -PSProvider FileSystem -Root "\\$computer\..." -Credential $cred
You must be logged in to reply to this topic.