pocketsevens
Contributor
Contributor

PowerCLI Set-CDDrive cmdlet gives strange error

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?

22 Replies
LucD
Leadership
Leadership

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


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
pocketsevens
Contributor
Contributor

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

0 Kudos
LucD
Leadership
Leadership

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.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
penumbra2011101
Contributor
Contributor



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


0 Kudos
pocketsevens
Contributor
Contributor

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

0 Kudos
LucD
Leadership
Leadership

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


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
pocketsevens
Contributor
Contributor

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

0 Kudos
LucD
Leadership
Leadership

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


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
pocketsevens
Contributor
Contributor

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

0 Kudos
MarcBouchard
Enthusiast
Enthusiast

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

0 Kudos
LucD
Leadership
Leadership

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


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
kclinden
Enthusiast
Enthusiast

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

0 Kudos
Konflikt
Enthusiast
Enthusiast

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

0 Kudos
Konflikt
Enthusiast
Enthusiast

same results with 5.5 R2.

0 Kudos
dbutch1976
Hot Shot
Hot Shot

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

0 Kudos
LucD
Leadership
Leadership

Did you already try with the last build ?

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


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
MRFelki
Contributor
Contributor

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

0 Kudos
Wh33ly
Hot Shot
Hot Shot

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

Don't have a 5.5 installing running

0 Kudos
william_faulk
Contributor
Contributor

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.

0 Kudos