remote invoke question

3 pc in one workgroup:pc1,pc2,pc3, all have ps v2.0
in scriptA,pc1 use invoke-command to send a scriptB to pc2,3.
scriptB will change pc2,3’s ip address.

question:
how can i know which pc’s set is ok or failed?
or
how does invoke-command ensure send script to which pc is ok?

If there are errors, they’d be returned to PC1.

thanks Donl,
but when run scriptA,after invoke-command,
the powershell console wait a long time to end . (2 pc used about 4 min)
in the last it tell me ,get data from remote serve failed.
of course,the ip is changed.
how can pc2/3 tell pc1 don’t wait for more data ?

Some ideas to consider: Instead of invoking the command to change the IP address inside of the remoting session, you can create a new PowerShell process to change the IP address using Start-Process (that is, by invoking Start-Process inside of the Invoke-Command script block). That would allow you to remotely start a secondary PowerShell process and then return immediately to pc1. In your secondary PowerShell process you can change the IP address. To make sure that the IP address does not change before Invoke-Command returns to PC1, you could add a call to start-sleep just to give the remote command enough time to finish and close the session.

thanks Poshoholic!

i a beginner in script programming,your advice have great value to me!
But how to write this command about your advice?

pc1 send script to pc2,3 with some arguments to run
(such as [hashtable]$hm=@{pc2=“aaa”;pc3=“bbb”})
pc2,3 find itself information from input arguments

It’s too difficult for me,i will think about it later.