The -ToSession parameter for copy-item should accept multiple sessions
The Copy-Item cmdlet now supports copying to a remote session. I typically work against a farm of servers and do something like
$s = new-pssession server1, server2, server3.
I want to be able to do copy c:\file.txt -tosession $s -destination c:\file.txt.
Right now, I get an error saying cannot convert an array of objects to a System.Management.Automation.Runspaces.PSSession object. I had to copy the file 3 different times to each session.
Thank you for your input. Based on its current ranking compared to other feedback items and product schedule, work on this item is pending (and will be driven by) further customer input. If you did not open this issue and are also impacted by it, please vote this item up.
1 comment
-
Richard Diphoorn commented
Same problem here. I solved it for now like this:
foreach ( $psSes in $psSession ) {
Copy-Item -Path ~\Downloads\UcmaRuntimeSetup.exe -Destination 'C:\Temp' -ToSession $psSes
}Not ideal but it works.