I'm writing a script that creates a new VM from a template and I need to change a file on the guest's hard drive. I believe Copy-VMGuestFile is the right way to do this, but it doesn't seem to work before turning the VM on. So the question is, how can my script decide that the VM is in a steady state, especially since the VM goes through a reboot cycle after first boot and the initial configuration completes? Or is there a better way?
If it matters, the target OS is Windows but ultimately I may want to do something very similar on Linux.