When attempting to change ISOs on a powered on guest instance, set-cddrive is returning an error but completing the command. A couple different commands produce the same result:
$theVM | Get-CDDrive | Set-CDDrive -NoMedia -Confirm:$false
$theVM | Get-CDDrive | Set-CDDrive -Connected $true -ISOPath $iso -Confirm:$false
both produce: Set-CDDrive Operation is not valid due to the current state of the object
What state might that be? Is set-cddrive dependent on either CusomizeVM_Task or ReconfigVM_Task?
The kicker here is that the operation appears to succeed, even though it returns an error.
Edit:
error has now changed to "ide0:0 already exists" without any changes to scripting.
Found this KB, indicating it might be a bug: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2092716