I have a situation where I need to open multiple PS consoles and run the commands for different servers from my script.
Ex: When I run the main script on my powershell then based on the number of host inputs I given, those many new PS instances should auto start and start executing the specific command on each console on its own.
I want to execute "Test-ReplicationHealth" for several hosts which are located in different geographical locations. I cannot enable remoting and I cannot wait for rest of the hosts till its finishes one. So what I thought the above will accomplish my requirement. The reason why I want this is, the user should now the progress in window ( not sure this can be achieved by jobs)
You can use Start-Job. It'll run locally, and do whatever your script needs to do. Just start one job per host instead of launching consoles. Way less overhead and easier to collect the results. No Remoting needed.