You got me completely confused now
My understanding is the following:
The Invoke-VMScript relies on the VMware Tools to execute a script inside the guest OS.
When the VM is powered off, the VMware Tools are not running, and the Invoke-VMScript can not run.
Perhaps I'm missing the bigger picture here, but:
- do you run the script containing the Invoke-VMScript with the RunAsync switch or not ?
- I guess the deployment of a the new VM is done with a New-VM cmdlet. When and through what do you start the script to change the root password ? You have to make sure the VM is powered on and that the customization is completed (which is quite fast on a Linux box)
- The output of the script you launch with the Invoke-VMScript is stored in the /tmp folder (your /tmp/vmware7 file from the message). Could the whole thing be a catch-22 in the end ?
- You authenticate as root on the Invoke-VMScript cmdlet to logon to the guest OS
- You change the root password
- The Invoke-VMScript tries to copy the temp file with the output of your script, but since the password has been changed, the authentication fails