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.