3

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

Devnull
  • 951
  • 1
  • 7
  • 23

1 Answers1

2

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.

Eric
  • 544
  • 1
  • 5
  • 15