Automation

 View Only
Expand all | Collapse all

PowerCLI Set-CDDrive cmdlet gives strange error

  • 1.  PowerCLI Set-CDDrive cmdlet gives strange error

    Posted Mar 14, 2014 06:01 PM

    So I wrote a function for my VMware management scripts that disconnects any ISOs that may be mounted to a VM.

    The command I used:  Get-CDDrive -VM $vm | Set-CDDrive -NoMedia -Confirm:$false

    The error I get: "Device 'ide1:0' already exists."

    The strange thing is, it works as intended.  And within the script, I can suppress the error.  But my 'Recent Tasks' in vSphere gets spammed when I run the function against a large series of VMs.

    Anyone seen this?



  • 2.  RE: PowerCLI Set-CDDrive cmdlet gives strange error

    Posted Mar 15, 2014 09:28 AM

    Do you have a CD/DVD drive on IDE 1:0 ?



  • 3.  RE: PowerCLI Set-CDDrive cmdlet gives strange error

    Posted Mar 15, 2014 01:45 PM

    I can't 100% confirm since I'm not at work now, but I think the CD drives are all on ide1:0. 



  • 4.  RE: PowerCLI Set-CDDrive cmdlet gives strange error

    Posted Mar 15, 2014 02:47 PM

    Just tried it on several PowerCLI builds, but I can't seem to be able to reproduce this.

    Which PowerCLI build are you using ? Do a 'Get-PowerCLIVersion'.

    And no, I haven't seen that error before.



  • 5.  RE: PowerCLI Set-CDDrive cmdlet gives strange error

    Posted Mar 18, 2014 11:13 AM



    Hi,


    i got the same error when i try to edit the cd drive. I got the error on every action e.g.


    Get-VM vmname | Get-CDDrive | Set-CDDrive -NoMedia -Confirm:$false
    Get-VM vmname | Get-CDDrive | Set-CDDrive -Connected $false -Confirm:$false


    My PowerCLI ist up to date:


    PowerCLI Version


    -




       VMware vSphere PowerCLI 5.5 Release 1 build 1295336


    -




    Snapin Versions


    -




       VMWare AutoDeploy PowerCLI Component 5.5 build 1262826



       VMWare ImageBuilder PowerCLI Component 5.5 build 1262826



       VMware License PowerCLI Component 5.5 build 1265954



       VMware VDS PowerCLI Component 5.5 build 1295334



       VMware vSphere PowerCLI Component 5.5 build 1295334




  • 6.  RE: PowerCLI Set-CDDrive cmdlet gives strange error

    Posted Mar 18, 2014 02:25 PM

    That all matches the versions I have, so far I still haven't found a solution



  • 7.  RE: PowerCLI Set-CDDrive cmdlet gives strange error

    Posted Mar 18, 2014 05:53 PM

    Just to make sure, there is only 1 VM object in the $vm variable ?



  • 8.  RE: PowerCLI Set-CDDrive cmdlet gives strange error

    Posted Mar 18, 2014 06:08 PM

    Correct, just a single VM object.  It's weird, it seems like vmware thinks that by running the command I'm trying to create a new drive on ide1:0 for some reason



  • 9.  RE: PowerCLI Set-CDDrive cmdlet gives strange error

    Posted Mar 18, 2014 06:24 PM

    And you get the error only for that specific VM, or also for others ?



  • 10.  RE: PowerCLI Set-CDDrive cmdlet gives strange error

    Posted Mar 18, 2014 06:46 PM

    Same thing on all the VMs I've tried on this infrastructure.



  • 11.  RE: PowerCLI Set-CDDrive cmdlet gives strange error

    Posted Mar 23, 2014 03:06 PM

    Having the same error. It works and disconnects the ISO, but reports a failure.

    PowerCLI Version

    ----------------

       VMware vSphere PowerCLI 5.5 Release 1 build 1295336

    ---------------

    Snapin Versions

    ---------------

       VMWare AutoDeploy PowerCLI Component 5.5 build 1262826

       VMWare ImageBuilder PowerCLI Component 5.5 build 1262826

       VMware vCloud Director PowerCLI Component 5.5 build 1295337

       VMware License PowerCLI Component 5.5 build 1265954

       VMware VDS PowerCLI Component 5.5 build 1295334

       VMware vSphere PowerCLI Component 5.5 build 1295334



  • 12.  RE: PowerCLI Set-CDDrive cmdlet gives strange error

    Posted Mar 24, 2014 06:09 AM

    On the off chance that PowerCLI 5.5 R2 build 1671586 might fix this, did you already try to install the latest version ?



  • 13.  RE: PowerCLI Set-CDDrive cmdlet gives strange error

    Posted Apr 17, 2014 06:52 AM

    I have the same issue. this is only a one liner, i think it worked before:

    powercli version: 5.5 R1. I'll try with the R2 soon.

    get-vm myvmname | Get-CDDrive | Set-CDDrive -nomedia -Confirm:$false

    Set-CDDrive : 2014.04.17. 8:48:25    Set-CDDrive        The operation for the entity "myvmname" failed with the following message: "Device 'ide1:0' already exists."

    At line:1 char:33

    + get-vm myvmname | Get-CDDrive | Set-CDDrive -nomedia -Confirm:$false

    +                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        + CategoryInfo          : NotSpecified: (:) [Set-CDDrive], GenericVmConfigFault

        + FullyQualifiedErrorId : Client20_TaskServiceImpl_CheckServerSideTaskUpdates_OperationFailed,VMware.VimAutomation.ViCore.Cmdlets.Commands.VirtualDevice.SetCDDrive



  • 14.  RE: PowerCLI Set-CDDrive cmdlet gives strange error

    Posted Apr 17, 2014 08:20 AM

    same results with 5.5 R2.



  • 15.  RE: PowerCLI Set-CDDrive cmdlet gives strange error

    Posted Jul 22, 2014 03:12 PM

    Has anyone had any luck fixing this?  Same error using VMware vSphere PowerCLI 5.5 Release 2 build 1671586.  My syntax is:

    VMware vSphere PowerCLI 5.5 Release 2 build 1671586

    Get-VM * | Get-CDDrive | where { $_.IsoPath -or $_.HostDevice -or $_.RemoteDevice } | Set-CDDrive-NoMedia -Confirm:$false



  • 16.  RE: PowerCLI Set-CDDrive cmdlet gives strange error

    Posted Jul 22, 2014 05:04 PM

    Did you already try with the last build ?

    Changes it will be fixed are slim, but one never knows :smileygrin:



  • 17.  RE: PowerCLI Set-CDDrive cmdlet gives strange error

    Posted Apr 16, 2014 03:32 PM

    I have the same problem. I updated my powerCLI and it is the same.



  • 18.  RE: PowerCLI Set-CDDrive cmdlet gives strange error

    Posted Oct 13, 2014 05:10 PM

    still getting this error with:

    PowerCLI Scripts:\> Get-PowerCLIVersion PowerCLI Version ----------------  
    VMware vSphere PowerCLI 5.5 Release 2 Patch 1 build 1931983 --------------- 
    Snapin Versions ---------------    
    VMWare AutoDeploy PowerCLI Component 5.5 build 1890764 
      VMWare ImageBuilder PowerCLI Component 5.5 build 1890764   
    VMware vCloud Director PowerCLI Component 5.5 build 1649227  
      VMware License PowerCLI Component 5.5 build 1265954    
    VMware VDS PowerCLI Component 5.5 build 1926677   
    VMware vSphere PowerCLI Component 5.5 Patch 1 build 1926677



  • 19.  RE: PowerCLI Set-CDDrive cmdlet gives strange error

    Posted Oct 14, 2014 09:22 AM

    Works fine on :    VMware vSphere PowerCLI 5.1 Release 2 build 1012425

    Don't have a 5.5 installing running



  • 20.  RE: PowerCLI Set-CDDrive cmdlet gives strange error

    Posted Oct 22, 2014 09:09 PM

    I'm also having this problem.  My command is as simple as:

    Get-VM -Name vmname | Get-CDDrive | Set-CDDrive -NoMedia

    The command performs the correct action — setting the drive to be disconnected and using the "Client Device", but produces the reported error.


    Set-CDDrive : 10/22/2014 4:48:53 PM    Set-CDDrive        The operation for the entity VirtualMachine-vm-723 failed with the following message: "Device 'ide1:0' already exists."

    At line:1 char:35

    + Get-VM | Get-CDDrive | Set-CDDrive <<<

        + CategoryInfo          : NotSpecified: (:) [Set-CDDrive], GenericVmConfigFault

        + FullyQualifiedErrorId :

    Client20_TaskServiceImpl_CheckServerSideTaskUpdates_OperationFailed,VMware.VimAutomation.ViCore.Cmdlets.Commands.VirtualDevice.SetCDDrive


    It only does this on hosts where the CD drive is on IDE1:0.  Most of my VMs are set up with the CD drive being on IDE0:0, but I have a few where they are on IDE1:0, probably due to an initial, but corrected, config error (I'm guessing a hard drive that was initially misconfigured to be IDE or maybe an accidental second CD drive) that got replicated through a template.


    Point being, try creating a VM with a CD drive on IDE1:0 and nothing on IDE0:0 (or any other IDE bus) and see if you can reproduce.



  • 21.  RE: PowerCLI Set-CDDrive cmdlet gives strange error

    Posted Oct 24, 2014 09:55 PM

    Actually, I just found that I have others that have CDs on IDE1:0 that don't exhibit this problem.  So I did a network snoop (via Wireshark and its SSL decrypter) to compare, and I found that the SOAP request being made to my vCenter server was identical other than the content of /soap:Envelope/soap:Body/ReconfigVM_Task/_this[@type='VirtualMachine'] (pseudo-XPath notation), which was vm-757 vs. vm-723.  (I determined this by running each SOAP request through xmllint --format and running those results through diff.  That one line was literally the only difference.)


    The rest of the SOAP requests were incidental or requesting status on the task.


    This would imply that there's something in vCenter and/or ESXi that is causing that error and that PowerCLI is just reporting the error.  Of course, why it doesn't happen when the same task is requested via the Web Client is strange.  Maybe I'll try and capture that data, too, and see what it's doing differently.



  • 22.  RE: PowerCLI Set-CDDrive cmdlet gives strange error

    Posted Oct 24, 2014 11:50 PM

    It turns out that the Web Client proxies everything through Flash AMF Objects and it was being a real pain to decode, so I gave up and looked at what the Windows "fat" client does.  I found that the biggest difference is that PowerCLI sets the CD drive to "VirtualCdromRemotePassthroughBackingInfo" in "Exclusive" mode and the fat client sets the CD drive to "VirtualCdromRemoteAtapiBackingInfo" and does not specify exclusivity.

    The other thing that I noticed is that the system that complains has a VM Version of 10, which means that the fat client won't edit its settings at all, whereas the other is on version 9, and snooping on that one was where I saw the different backing type, so the backing type difference may be a red herring.



  • 23.  RE: PowerCLI Set-CDDrive cmdlet gives strange error

    Posted Nov 13, 2014 01:56 PM