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.


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


The link you mention says it is resolved in powercli v6, this is true in my experience. In my v5 code I always uses set-cddrive -ErrorAction:SilentlyContinue but It is not needed now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.