We're using Invoke-VMScript to run batch scripts on our VMs in a blocking manner. Some of these scripts take ~1 hour to run. We're running into issues where randomly we'll see Power-CLI disconnects or other exceptions during the execution of the script. Potentially these are due to hardware/configuration issues, but we were wondering if running long scripts with Invoke-VMScript was a bad practice. Would it be better/more robust to run the scripts asynchronously and then poll until complete?
↧