Invoke-Command - Separate CSV for Each Computer

Is it possible to use Invoke-Command to multiple computers, and then output each computer’s results into their own CSV (that does not already exist)? Better yet, one file with one tab per computer containing the results?

I could accomplish this using a foreach loop but that would be quite inefficient compared to the parallelism of Invoke-Command.

I’ve been searching the forum but haven’t found anything yet. Thank you for any input.

Objects returned from invoke-command are returned with extra properties, one of which has the computer name. If you capture the results and run that thru group-object on that computer name property, you can loop over the groups and create a csv file for each computer. Creating an excel file can be done, but I’m not experienced with it.

You could use the -Asjob parameter of Invoke-Command and then retrieve the job output and place the return from each into individual csv files.

+1 Jonathan.

Use -AsJob. Then you can enumerate the child jobs using ForEach and receive their results into a CSV apiece.

“-AsJob” is the winner, thanks guys. Another simple solution… Still absorbing and assimilating PowerShell MOLs.